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/2006-August/068091.html below:

[Python-Dev] __index__ clipping

[Python-Dev] __index__ clipping [Python-Dev] __index__ clippingGuido van Rossum guido at python.org
Wed Aug 9 23:46:09 CEST 2006
Here's another issue where Neal thought it would be useful if I
weighed in. I'm not quite sure of the current status, but perhaps the
following would work?

- Called from Python, (10**10).__index__() should return 10000000000L,
not raise an exception or return sys.maxint.

- The nb_index slot is changed to return an object; it should return a
Python int or long without clipping (same as __index__() called from
Python).

- There should be three C APIs (perhaps fewer if some of them are never needed):

  - One to call the nb_index slot, or raise an exception if it's not
set, returning the object

  - One to return the clipped value without an exception
    (can still return an exception if something else went wrong)

  - One to return the value if it fits, raise OverflowError if it doesn't

I know this is quite the deviation from the current code but it seems
the most rational and future-proof approach.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
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