Christophe BAL added the comment: I don't agree with you. I prefer to add new functionalities to the paths I use. This is the power of OOP. It is easier and cleaner to use *mypath.common_with(otherpath)* than *common_with(**mypath, **other path)* .
Python is highly OOP, so you can't say *"don't use subclassing in your case"*. As a user, I should have the possibility to use the method I want. Another example is the use of *onepath - anotherpath* instead of *onepath.relative_to(**another path)* . That's the power of the magic method to add this kind of feature. *Christophe BAL* *Enseignant de mathématiques en Lycée **et développeur Python amateur* *---* *French math teacher in a "Lycée" **and **Python **amateur developer* 2015-05-06 20:21 GMT+02:00 Paul Moore <rep...@bugs.python.org>: > > Paul Moore added the comment: > > For that type of function, I'd suggest you use a standalone function > rather than subclassing and methods or operator overloading. You don't gain > enough to be worth the complexity of having to subclass path objects. And > duck typing means that your function works for any subclass of (Pure)Path > without change. > > ---------- > > _______________________________________ > Python tracker <rep...@bugs.python.org> > <http://bugs.python.org/issue24132> > _______________________________________ > ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue24132> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com