23.05.17 20:04, Brett Cannon пише:
On Tue, 23 May 2017 at 03:13 Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de <mailto:wolfgang.ma...@biologie.uni-freiburg.de>> wrote:
    My proposal is to change this to:
    1) check whether the type of the argument is str or bytes *exactly*; if
    so, return the argument unchanged
    2) check wether __fspath__ can be called on the type and returns an
    instance of str, bytes, or any subclass (just like in the current
    version)
    3) check whether the type is a subclass of str or bytes and, if so,
    return it unchanged

What exactly is the performance issue you are having that is leading to this proposal?

It seems to me that the purpose of this proposition is not performance, but the possibility to use __fspath__ in str or bytes subclasses. Currently defining __fspath__ in str or bytes subclasses doesn't have any effect.

I don't know a reasonable use case for this feature. The __fspath__ method of str or bytes subclasses returning something not equivalent to self looks confusing to me.

_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to