[Python-checkins] r68276 - in python/trunk: Lib/distutils/command/sdist.py Lib/distutils/tests/test_sdist.py Misc/NEWS

Nick Coghlan ncoghlan at gmail.com
Sun Jan 4 02:49:26 CET 2009


Georg Brandl wrote:
> tarek.ziade schrieb:
>> +        # pruning out vcs directories
>> +        # both separators are used under win32
>> +        seps = sys.platform == 'win32' and r'/|\\' or '/'
>> +        vcs_dirs = ['RCS', 'CVS', '\.svn', '\.hg', '\.git', '\.bzr', '_darcs']
> 
>                                       ^        ^       ^        ^
> You should double these backslashes or use raw strings.


Agreed - while the code will work as written, relying on a given
character not being part of an escape sequence (i.e. "." in this case)
is a rather dubious way to do things.

Better to be explicit and escape the backslash or use raw strings as
Georg suggests.

Using an if/else conditional expression on the line above would also be
clearer than using the and/or chain.

Cheers,
Nick.

P.S. Added Tarek explicitly to the CC list. Tarek, if you aren't
subscribed to python-checkins yet, please head to python.org and sign up
for it - follow-up comments in the response to the checkin message are a
useful form of post-commit review.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------


More information about the Python-checkins mailing list