int() 24 times slower then long() in Python 2.3

Willem willem179 at yahoo.com
Thu Jul 15 04:58:18 EDT 2004


James Henderson <james at logicalprogression.net> wrote in message news:<mailman.373.1089807240.5135.python-list at python.org>...
> On Wednesday 14 July 2004 12:28 pm, paolo veronelli wrote:
> >
> > On Wed, 14 Jul 2004 11:08:16 +0100, James Henderson wrote:
> > >
> > > I think you should look at PEP 237 "Unifying Long Integers and Integers"
> > > - it
> > > may even reassure you.  As Peter Hansen has already hinted in reply to
> > > another of your messages, Python is in the process of unifying longs and
> > > ints.
> > >
> > > It used to be that calling int() on a big number gave an exception -
> > > perhaps a
> > > more Pythonic version of your requested giving the wrong result - and now
> > > that it doesn't I suppose there is a sense in which the current
> > > distinction
> > > between ints and longs is "unmeaningful" from the user's point of view
> > > (it's
> > > not meaningless under the hood of course).  According to the PEP the
> > > decision
> > > to keep two types was that it:
> > >
> > >     is far easier to implement, is backwards
> > >     compatible at the C API level, and in addition can be implemented
> > >     partially as a transitional measure.
> > >
> > > Perhaps you thing that ints and longs should not be unified but I won't
> > > start
> > > arguing till you come out and say it. :)
> > >
> > > James
> >
> > I don't want to change any way the base of PEP 237,but this kind of
> > performance
> > flaw  is a problem and it's possible to be the first of  a long list.
> > It's good to know, always ,why we pay a price.Better an Error then a ghost
> > warning,which
> > is itself the cause of the flaw.
> > Python is fast ,this is why I use it.Anyone has a different goal in using
> > it.
> >
> >         Regards    Paolino
> 
> I actually agree it's a shame that even ignored warnings have such a 
> performance impact but at least these warnings are scheduled to be removed 
> sometime in Python 2.4 (they're still there in 2.4a1 though).  Apparently 
> they were added for "those concerned about extreme backwards compatibility".
> 
> James

That was indeed the reason of my original posting: As a casual
programmer I was disturbed that upgrading to Python 2.3 actually
slowed down my program significantly and that I had to spend so much
time to find the reason: somebody has decided to hide these particular
overflow warnings ...
Why warning and then suppressing it by default?
I understand the problem will disappear in the next version.
I apologize for my remark on "over-engineering". I posted the message
when I was still angry, having spent so much time in finding the "bug"

Willem



More information about the Python-list mailing list