On 11.05.2016 23:57, Brett Cannon wrote: > On Wed, 11 May 2016 at 14:29 Nikolaus Rath <Nikolaus at rath.org > <mailto:Nikolaus at rath.org>> wrote: > > On May 11 2016, Brett Cannon <brett at python.org > <mailto:brett at python.org>> wrote: > > This PEP proposes a protocol for classes which represent a file > system > > path to be able to provide a ``str`` or ``bytes`` representation. > [...] > > As I said before, to me this seems like a lot of effort for a very > specific use-case. > Exactly. Especially when considering what else can be done to improve the situation considerably. > So let me put forward two hypothetical scenarios to > better understand your position: > > - A new module for URL handling is added to the standard library (or > urllib is suitably extended). There is a proposal to add a new > protocol that allows classes to provide a ``str`` or ``bytes`` > representation of URLs. > > - A new (third-party) library for natural language processing arises > that exposes a specific class for representing audio data. Existing > language processing code just uses bytes objects. To ease transition > and interoperability, it is proposed to add a new protocol for > classes > that represend audio data to provide a bytes representation. > You can even add the timedelta-to-seconds protocol that somebody thought would be good idea: https://mail.python.org/pipermail/python-dev/2016-April/144018.html https://mail.python.org/pipermail/python-ideas/2016-May/040226.html The generalization is straight-forward and a result of this discussion. If it works and is a good idea for pathlib, then there's absolutely no reason not to do this for the datetime lib and other rich-object libs. Same goes the other way round. Question still is: is it a good idea? Maybe, it will become a successful pattern. Maybe not. > Do you think you would you be in favor of adding these protocols to > the stdlib/languange reference as well? > > > Maybe for URLs, not for audio data (at least not in the stdlib; > community can do what they want). > > If not, what's the crucial > difference to file system paths? > > > Nearly everyone uses file system paths on a regular basis, less so > than URLs but still a good amount of people. Very few people work with > audio data. Amount of usage should be taken into account of course. However, question remains if that suffices as a justification for the effort. Best, Sven -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20160512/0e9bffaf/attachment.html>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4