Re: Python "is" behavior

2008-06-21 Thread Martin v. Löwis
> For some reason, stacking multiple statements reuses the same object. Each code object has a co_consts tuple referring to all constants used in the code. The compiler interns duplicate constants for a single compiler run, resulting in the same object being used when the code is put into a single

Re: Python "is" behavior

2008-06-21 Thread Lie
On Jun 21, 2:14 am, Gary Herron <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > On Jun 20, 9:38 am, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > > >> On Fri, 20 Jun 2008 09:31:57 -0700 (PDT), [EMAIL PROTECTED] wrote: > > >>> I am not certain why this is the case, but... > > >> a =

Re: Python "is" behavior

2008-06-20 Thread Gary Herron
[EMAIL PROTECTED] wrote: On Jun 20, 9:38 am, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: On Fri, 20 Jun 2008 09:31:57 -0700 (PDT), [EMAIL PROTECTED] wrote: I am not certain why this is the case, but... a = 256 b = 256 a is b True a = 257 b = 257 a is b

Re: Python "is" behavior

2008-06-20 Thread Jean-Paul Calderone
On Fri, 20 Jun 2008 10:07:56 -0700 (PDT), George Sakkis <[EMAIL PROTECTED]> wrote: On Jun 20, 12:45 pm, [EMAIL PROTECTED] wrote: On Jun 20, 9:42 am, George Sakkis <[EMAIL PROTECTED]> wrote: > On Jun 20, 12:31 pm, [EMAIL PROTECTED] wrote: > > I am not certain why this is the case, but... >

Re: Python "is" behavior

2008-06-20 Thread George Sakkis
On Jun 20, 12:45 pm, [EMAIL PROTECTED] wrote: > On Jun 20, 9:42 am, George Sakkis <[EMAIL PROTECTED]> wrote: > > > > > On Jun 20, 12:31 pm, [EMAIL PROTECTED] wrote: > > > > I am not certain why this is the case, but... > > > > >>> a = 256 > > > >>> b = 256 > > > >>> a is b > > > > True > > > > >>>

Re: Python "is" behavior

2008-06-20 Thread michalis . avraam
On Jun 20, 9:42 am, George Sakkis <[EMAIL PROTECTED]> wrote: > On Jun 20, 12:31 pm, [EMAIL PROTECTED] wrote: > > > > > I am not certain why this is the case, but... > > > >>> a = 256 > > >>> b = 256 > > >>> a is b > > > True > > > >>> a = 257 > > >>> b = 257 > > >>> a is b > > > False > > > Can any

Re: Python "is" behavior

2008-06-20 Thread michalis . avraam
On Jun 20, 9:38 am, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > On Fri, 20 Jun 2008 09:31:57 -0700 (PDT), [EMAIL PROTECTED] wrote: > >I am not certain why this is the case, but... > > a = 256 > b = 256 > a is b > >True > > a = 257 > b = 257 > a is b > >False > > >

Re: Python "is" behavior

2008-06-20 Thread George Sakkis
On Jun 20, 12:31 pm, [EMAIL PROTECTED] wrote: > I am not certain why this is the case, but... > > >>> a = 256 > >>> b = 256 > >>> a is b > > True > > >>> a = 257 > >>> b = 257 > >>> a is b > > False > > Can anyone explain this further? Why does it happen? 8-bit integer > differences? No, implement

Re: Python "is" behavior

2008-06-20 Thread Jean-Paul Calderone
On Fri, 20 Jun 2008 09:31:57 -0700 (PDT), [EMAIL PROTECTED] wrote: I am not certain why this is the case, but... a = 256 b = 256 a is b True a = 257 b = 257 a is b False Can anyone explain this further? Why does it happen? 8-bit integer differences? http://mail.python.org/pipermail/pytho