[Python-ideas] PEP 428: poll about the joining syntax
steve at pearwood.info
Tue Oct 9 04:42:04 CEST 2012
And I knew there was another suggestion tickling around in my
subconscious... I have a new favourite:
`p & q` +1: unlikely to be confused with int or set &; strings
do not currently use it; suggests concatenation; short, can
work with two paths or path and string if needed.
p + ".ext" to add a suffix to the file name; an error if p is a
"spam" + p should probably an error. I can't think of a good use case
for prepending a string to a path.
p & q to concatenate (join) path q to path p.
p.add(q [, r, s, ...]) to concatentation multiple path components at
once, more efficient than p & q & r & ..., and to make the function more
discoverable and searchable.
More information about the Python-ideas