[Python-Dev] boxing and unboxing data types

Nathaniel Smith njs at pobox.com
Mon Mar 9 05:17:52 CET 2015


On Mar 8, 2015 9:13 PM, "Steven D'Aprano" <steve at pearwood.info> wrote:
>
> There's no built-in way of calling __index__ that I know of (no
> equivalent to int(obj)),

There's operator.index(obj), at least.

> but slicing at the very least will call it,
> e.g. seq[a:] will call type(a).__index__.

-n
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20150308/5f07c12b/attachment.html>


More information about the Python-Dev mailing list