[Python-ideas] PEP 428 - object-oriented filesystem paths
amcnabb at mcnabbs.org
Fri Oct 5 21:53:27 CEST 2012
On Fri, Oct 05, 2012 at 09:36:56PM +0200, Yuval Greenfield wrote:
> Though I don't understand why not to overload the "/" or "+" operators.
> Sounds more elegant than square brackets. Just make sure the op fails on
> anything other than Path objects.
Path concatenation is obviously not a form of division, so it makes
little sense to use the division operator for this purpose. I always
wonder why the designers of C++ felt that it made sense to perform
output by left-bitshifting the output stream by a string:
std::cout << "hello, world";
Fortunately, operator overloading in Python is generally limited to
cases where the operator's meaning is preserved (with the unfortunate
exception of the % operator for strings).
PGP Fingerprint: 8A17 B57C 6879 1863 DE55 8012 AB4D 6098 8826 6868
More information about the Python-ideas