Hey,
I am creating this ticket to discuss topics related to coding style.
When coding I am usually firing refactor & optimize imports from my IDE, which complies more or less with PEP8 - Python style guide. Probably the only changed thing I have is maximum line length, as for me 100-120 or even 140 is acceptable these days.
What do you think about:
var1 = value
long_var = value2
vs:
var1 = value
long_var = value2
I am up for the latter as it is the "default" for Python coding.
Also, we could start using:
var1 = value
long_var = value2
Should be the standard. The former causes more work and unnecessary changes to the blame on variable renames.
No opinion on line length.
But I like vertically aligned operators, and will continue to use them.
Feel free to / to not :)
i personally don't care too much, however what i really care a lot are commit diffs... so whatever we do, please don't mix style changes with feature/code changes :stuck_out_tongue_closed_eyes:
This is what "-b" (git) and "?w=1" (GitHub) are for ๐
In any case, I agree with not changing code just to adjust style, within a feature addition.
I won't go out of my way to align things if you guys don't go out of your way to un-align them ๐
It may also be relevant to look at the PEP8 guidelines / rules we (I) decided on for Pwntools: https://github.com/Gallopsled/pwntools/pull/773
tl;dr is:
[pep8]
ignore = E203,E227,E251,E226,E501,E221,E241,E402,E261,E265,E704,W603,W503
max-line-length=120
exclude = pwnlib/constants,pwnlib/util/hashes.py,pwnlib/util/crc/known.py,pwnlib/encoders/arm/alphanumeric
To elaborate on each of the rules above:
E203 # Permit whitespace before around , and :
E221 # Permit multiple spaces before operator
E226 # Do not require whitespace around arithmetic operators
E227 # Do not require whitespace around bitwise operaitons
E241 # Permit multiple spaces after ','
E251 # Do not require whitespace around keyword/parameter equals
E261 # Do not require two spaces before inline comments
E265 # Block comments do not require space after '#'
E402 # Permit imports anywhere in the file
E501 # Permit any lines longer than 80
E704 # Permit one-liner def foo(): bar
W503 # Permit breaking before operators
W603 # Permit <>
Added the configuration file in 2b5e394. Since the pep8 command-line utility supports this location for project-specific configuration, both PyCharm and SublimeAutoPEP8 support it as well.
What do you think about removing this line:
force_single_line = 1
from isort.cfg?
I'd rather have:
from pwndbg.color import red, green, yellow
Instead of:
from pwndbg.color import red
from pwndbg.color import green
from pwndbg.color import yellow
How about just from pwndbg.color import * ๐
Lots of other places to import pwndbg.color as C so you can just access C.red etc.
Personally I think it'd be hilarious to do something like
import pwndbg.color.yellow as โญ๏ธ
import pwndbg.color.red as ๐
import pwndbg.color.green as โ