On 2012-10-08 23:17, Richard Oudkerk wrote:
On 08/10/2012 9:22pm, Paul Moore wrote:
p.joinpath(q) +1 I wish there was a better name, but I doubt one will appear :-(
I would go for
p.add(q)
I like the short 'add'. A small problem I see with 'add' (and with 'append') is that the outcome of adding (or appending) an absolute path is too surprising, unlike with the 'join' or 'joinpath' names.
Also, How would we add an extension to a path (without turning it into a str first)? Will there be a method called addext() or addsuffix() as the .ext/.suffix property is immutable? The suggestions I saw in the thread so far targeted substituting the extension, not adding.
Regarding '/', I would like to mention Scapy [1], the packet manipulation program. From its documentation: "The / operator has been used as a composition operator between two layers". The '/' feels natural to use with Scapy. An example from the docs:
Let’s say I want a broadcast MAC address, and IP payload to ketchup.com and to mayo.com, TTL value from 1 to 9, and an UDP payload:
Ether(dst="ff:ff:ff:ff:ff:ff")/IP(dst=["ketchup.com","mayo.com"],ttl=(1,9))/UDP()
Regards, TB