Remove unneeded start parameter of zero from Python range function #13220

pull jbampton wants to merge 1 commits into bitcoin:master from jbampton:range-fix changing 3 files +4 −4
  1. jbampton commented at 11:27 AM on May 12, 2018: contributor

    This removes the default first parameter of zero from Python range functions when it's not needed.

    https://docs.python.org/3.5/library/stdtypes.html#range

    The majority of the codebase uses the range without the zero as the first parameter.

    I used a regex in PyCharm to just search through Python files for the range functions that I changed in this PR. Regex was -> range *\( *0

    The only other results are the range functions that use all three parameters, start - stop - step.

  2. Remove unneeded start parameter of zero from Python range function 483a5e6672
  3. fanquake added the label Refactoring on May 12, 2018
  4. MarcoFalke commented at 1:44 PM on May 12, 2018: member

    The changes look correct, but according to the guidelines I have to close this (c.f. the section on refactoring https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#refactoring)

    Generally, if the style is not mentioned and fixed in the developer notes, we leave it up to the original author to pick whatever fits them best personally and then leave it that way until the line is touched for other reasons.

  5. MarcoFalke closed this on May 12, 2018

  6. MarcoFalke commented at 1:50 PM on May 12, 2018: member

    If you are looking for small things to help out with, you can

    • search through the good first issues or the ones that are up for grabs.
    • write tests to improve the coverage (both unit tests and rpc tests are welcome)
    • help with review and testing (There are easy ones such as the gui and rpc)
    • join us on irc and let us know what you are interested in.
  7. jbampton commented at 2:26 PM on May 12, 2018: contributor

    Hey @MarcoFalke I understand. Would adding a new Python Flake 8 check be something that was valued as pull request ?

  8. jbampton deleted the branch on May 12, 2018
  9. MarcoFalke commented at 3:01 PM on May 12, 2018: member

    They are already handled in #13214. Feel free to leave a comment there.

  10. kanzure commented at 3:40 PM on May 12, 2018: contributor

    Also, an initial zero in the range is helpful for clarity, even if it is not strictly necessary for the actual function.

  11. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-22 06:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me