int vs long

Dan Bishop danb_83 at yahoo.com
Sun Jun 3 14:35:01 EDT 2007


On Jun 2, 11:55 pm, kaens <apatheticagnos... at gmail.com> wrote:
> On 02 Jun 2007 20:18:02 -0700, Paul Rubin
>
> <"http://phr.cx"@nospam.invalid> wrote:
> > Dan Bishop <danb... at yahoo.com> writes:
> > > Note that recent versions of Python automatically promote the results
> > > of integer arithmetic to long if necessary, so the distinction is less
> > > relevant than it used to be.
>
> > Note however that even in recent versions, there are still parts of
> > Python that get stuck at sys.maxint, for example the enumerate function.
> > --
> >http://mail.python.org/mailman/listinfo/python-list
>
> I didn't know that - I'll keep it in mind though. I can imagine that
> causing some pretty nasty annoyances if you ran into it unexpectedly

If you ever do, it's trivial to write your own enumerate():

def enumerate(seq):
    index = 0
    for item in seq:
        yield (index, item)
        index += 1




More information about the Python-list mailing list