Steven Bethard wrote: > My only fear with the / operator is that we'll end up with the same > problems we have for using % in string formatting -- the order of > operations might not be what users expect. Since join is conceptually > an addition-like operator, I would expect: > > Path('home') / 'a' * 5 > > to give me: > > home/aaaaa > > If I understand it right, it would actually give me something like: > > home/ahome/ahome/ahome/ahome/a Both of these examples are rather silly, of course ;) There's two operators currently used commonly with strings (that I assume Path would inherit): + and %. Both actually make sense with paths too. filename_template = '%(USER)s.conf' p = Path('/conf') / filename_template % os.environ which means: p = (Path('/conf') / filename_template) % os.environ But probably the opposite is intended. Still, it will usually be harmless. Which is sometimes worse than usually harmful. + seems completely innocuous, though: ext = '.jpg' name = fields['name'] image = Path('/images') / name + ext It doesn't really matter what order it happens in there. Assuming concatenation results in a new Path object, not a str. -- Ian Bicking | ianb at colorstudy.com | http://blog.ianbicking.org
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4