On Thu, Apr 7, 2016 at 11:44 AM, Nathaniel Smith <njs at pobox.com> wrote: > No, __index__ is the protocol for "do a safe coerce to integer". The name > is misleading, but its use in non-indexing contexts is well established. > E.g. > > " ab" * obj > > will return a string with obj.__index__() repetitions. > A good argument for Chris A's proposal over on python-ideas to have a dunder method for "coerce to a lossless string", that could be used for Path, but also for who knows what else? As I see it , exactly the same as the __fspath__ idea, except that we'd use a name that made it clear you might want to use it for other things (and str would grow that method...) -CHB -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20160407/45c2a8d3/attachment-0001.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