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

Tarek Ziadé ziade.tarek at gmail.com
Sun Jan 4 11:40:36 CET 2009


On Sun, Jan 4, 2009 at 2:49 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> 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.
>

Yes that's why I didn't use a raw string in the first place, but I agree it is
not very explicit.

> 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.
>

both done in r68293, thanks for the reviews !

Cheers
Tarek


More information about the Python-checkins mailing list