A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/attachments/20160407/612b6c33/attachment.html below:

<p dir="ltr">On Apr 7, 2016 10:00 AM, "Chris Barker" <<a href="mailto:chris.barker@noaa.gov">chris.barker@noaa.gov</a>> wrote:<br>
><br>
> On Thu, Apr 7, 2016 at 12:00 AM, INADA Naoki <<a href="mailto:songofacandy@gmail.com">songofacandy@gmail.com</a>> wrote:<br>
>><br>
>><br>
>> I feel adding protocol only for path is bit over engineering. So I'm -0.5 on adding __fspath__.<br>
>><br>
>> I'm +1 on adding general protocol for *coerce to string* like __index__.<br>
><br>
><br>
> isn't __str__ the protocol for "coerce to string" ?<br>
><br>
> __index__ is a protocol for "coerce to an integer that can be used as an index", which is like __fspath__ would be "coerce to a string that can be used as a path"</p>
<p dir="ltr">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.</p>
<p dir="ltr">" ab" * obj</p>
<p dir="ltr">will return a string with obj.__index__() repetitions.</p>
<p dir="ltr">-n</p>

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