A RetroSearch Logo

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

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-February/061165.html below:

[Python-Dev] Please comment on PEP 357 -- adding nb_index slot to PyNumberMethods

[Python-Dev] Please comment on PEP 357 -- adding nb_index slot to PyNumberMethods [Python-Dev] Please comment on PEP 357 -- adding nb_index slot to PyNumberMethodsBernhard Herzog bh at intevation.de
Thu Feb 16 20:59:10 CET 2006
"Travis E. Oliphant" <oliphant.travis at ieee.org> writes:

>     2) The __index__ special method will have the signature
>
>        def __index__(self):
>            return obj
>        
>        Where obj must be either an int or a long or another object
>        that has the __index__ special method (but not self).

So int objects will not have an __index__ method (assuming that ints
won't return a different but equal int object).  However:

>     4) A new operator.index(obj) function will be added that calls
>        equivalent of obj.__index__() and raises an error if obj does not
>        implement the special method.

So operator.index(1) will raise an exception.  I would expect
operator.index to be implemented using PyNumber_index.

   Bernhard

-- 
Intevation GmbH                                 http://intevation.de/
Skencil                                           http://skencil.org/
Thuban                                  http://thuban.intevation.org/
More information about the Python-Dev mailing list

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