On Sep 7, 7:29 am, Wojtek Walczak <[EMAIL PROTECTED]> wrote:
> On Sat, 06 Sep 2008 23:04:14 +0200, Andreas Hofmann wrote:
> >                  if mult is 1:
>
>                            ^^
> You're testing for identity, not for equality.
> Change it to "if mult == 1". Is it alright now?
>

Although he definitely should not be using "is" here, that can not be
the problem if he is using CPython. As an optimisation, small integers
are interned i.e. for each small integer, there is only one object.

>>> a = 1
>>> b = 10000
>>> a is 1
True
>>> b is 10000
False
>>> id(a)
10897704
>>> id(1)
10897704
>>> id(b)
11893004
>>> id(10000)
12633044
>>>

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to