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/2005-February/051681.html below:

[Python-Dev] Fixing _PyEval_SliceIndex so that integer-like objects can be used

[Python-Dev] Fixing _PyEval_SliceIndex so that integer-like objects can be used [Python-Dev] Fixing _PyEval_SliceIndex so that integer-like objects can be usedDavid Ascher david.ascher at gmail.com
Sat Feb 19 00:08:24 CET 2005
On Fri, 18 Feb 2005 15:40:54 -0700, Travis Oliphant <oliphant at ee.byu.edu> wrote:
> Guido van Rossum wrote:
> 
> >>Would it be possible to change
> >>
> >>_PyEval_SliceIndex  in ceval.c
> >>
> >>so that rather than throwing an error if the indexing object is not an
> >>integer, the code first checks to see if the object has a
> >>tp_as_number->nb_int method and calls it instead.
> >>
> >>
> >
> >I don't think this is the right solution; since float has that method,
> >it would allow floats to be used as slice indices,
> >
> >
> O.K.,
> 
> then how about if arrayobjects can make it in the core, then a check for
> a rank-0 integer-type
> arrayobject is allowed before raising an exception?

Following up on Bob's point, maybe making rank-0 integer type
arrayobjects inherit from int has some mileage?  Somewhat weird,
but...
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