You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today txt2tags code styling is a mess. Well aligned code is something your
learn to love one day or another. Mine came later :)
Coding style is a matter of taste, and how I don't want to impose my own taste
anymore, we need to follow a standard. And PEP-8 is the standard for Python
code.
http://www.python.org/dev/peps/pep-0008/
I will gradually change the txt2tags code aiming to be closer to PEP-8. Maybe
being 100% compliant is not needed. But any movement in that direction is a
win, so I'll start it.
My mais goal for now is simple:
- Use 4 spaces instead TABs for indentation
- One command per line
- One import per line
- Correct spacing between operators (like a = 1)
- Use 'single quotes' for string literals, and """triple double quotes""" for
docstrings
This will bring absolutely no changes to the code logic or commands, they're
just visual. But it may affect patches. I guess the most drastic ones will be
ready in a few hours.
I'll update this issue with news.
Original issue reported on code.google.com by aureliojargas@gmail.com on 12 Nov 2010 at 8:59
The text was updated successfully, but these errors were encountered:
Okay, items 1, 2 and 3 from the previous list are done.
The commits were from r459-467 (except r462).
I won't change anything in the next 4 or 5 days.
The code is safe to play with again :)
Original comment by aureliojargas@gmail.com on 12 Nov 2010 at 11:29
After many commits (search for PEP-8 in log messages), the code now is closer
to PEP-8 compliance.
There are only 3 errors (with multiple instances) pointed by the pep8.py script
(http://pypi.python.org/pypi/pep8)
$ pep8 txt2tags
txt2tags:88:11: E221 multiple spaces before operator
txt2tags:151:80: E501 line too long (142 characters)
txt2tags:244:11: E203 whitespace before ':'
$
This shows only the first line where the error appeared. For a detailed total
count of each error, one must use --statistics:
$ pep8 --statistics txt2tags
txt2tags:88:11: E221 multiple spaces before operator
txt2tags:151:80: E501 line too long (142 characters)
txt2tags:244:11: E203 whitespace before ':'
29 E203 whitespace before ':'
132 E221 multiple spaces before operator
149 E501 line too long (142 characters)
$
Fixing these, for now, is not really needed. E203 and E221 are visual
alignments for dictionary keys and variable setting. Fixing this will break the
following PEP-8 rule:
(1) When applying the rule would make the code less readable, even for
someone who is used to reading code that follows the rules.
E501 is about long lines, I'll let it untouched for now. I'm still not sure
breaking long lines with bring us any benefit.
Please, when writing new code, try to maintain PEP-8 compliance.
Run dist/check-code.sh before a commit (now checking PEP-8 too).
Original comment by aureliojargas@gmail.com on 23 Nov 2010 at 10:59
Original issue reported on code.google.com by
aureliojargas@gmail.com
on 12 Nov 2010 at 8:59The text was updated successfully, but these errors were encountered: