On Thu, 21 Apr 2011 14:35:25 +0200, Peter Otten wrote:
> Steven D'Aprano wrote:
>
>> but:
>>
> a = 1001; b = 10001; a is b
>> False
>
> I would hope so ;)
Doh!
>> The point is that Python is free to re-use immutable objects, or not
>> re- use them, as it sees fit.
>
> Indeed, and I eve
On Thu, Apr 21, 2011 at 02:38:52AM -0700, vino19 wrote:
> Hello, I'm a newbie.
> What's the defference between
>
> >>>a=-6; b=-6; a is b
> >>>True
>
> and
>
> >>>a=-6
> >>>b=-6
> >>>a is b
> >>>False
>
> ?
> --
> http://mail.python.org/mailman/listinfo/python-list
Depends on how the interpret
Steven D'Aprano wrote:
> but:
>
a = 1001; b = 10001; a is b
> False
I would hope so ;)
> The point is that Python is free to re-use immutable objects, or not re-
> use them, as it sees fit.
Indeed, and I even found a Python implementation on my harddisk that does
what you intended to sh
On Thu, 21 Apr 2011 02:55:52 -0700, vino19 wrote:
> Sure, I understand that "is" is not "==", cause "is" just compares
> id(a)==id(b).
>
> I have a win32 CPython and the range of "singletons" is from -5 to 256
> on my machine.
>
> I am asking about what happens in Python interpreter? Why is ther
vino19 wrote:
Sure, I understand that "is" is not "==", cause "is" just compares id(a)==id(b).
I have a win32 CPython and the range of "singletons" is from -5 to 256 on my machine.
I am asking about what happens in Python interpreter? Why is there a difference between running one
line like "
vino19 wrote:
> Hello, I'm a newbie.
> What's the defference between
>
a=-6; b=-6; a is b
True
>
> and
>
a=-6
b=-6
a is b
False
>
> ?
When you write it as a single line the assignments to a and b are part of
the same compilation process, and as an optimization CPython
Python 2.7.1 (downloaded from python.org a week ago)
You see, if I save this to a file and then run from CMD: "python test1.py" the
result will be the same: "True"
When I use IDLE or IPython or DreamPie or maybe something else then result is
not the same. So maybe as Chris Angelico said it is t
Am 21.04.2011 11:59, schrieb Heiko Wundram:
> Am 21.04.2011 11:55, schrieb vino19:
>> I am asking about what happens in Python interpreter? Why is there a
>> difference between running one line like "a=1;b=1" and two lines like "a=1
>> \n b=1"? Does it decide to locate memory in different types d
On Thu, Apr 21, 2011 at 8:38 PM, vino19 wrote:
> Hello, I'm a newbie.
> What's the defference between
>*skip*
What is version of CPython?
In 2.7.1 and 3.1.3 both versions return True, and moreover, are
compiled to identical bytecode.
>>> def test1():
... a=-6; b=-6; c = a is b
... return
On Thu, Apr 21, 2011 at 7:55 PM, vino19 wrote:
> Sure, I understand that "is" is not "==", cause "is" just compares
> id(a)==id(b).
>
> I have a win32 CPython and the range of "singletons" is from -5 to 256 on my
> machine.
>
> I am asking about what happens in Python interpreter? Why is there a
Am 21.04.2011 11:55, schrieb vino19:
> I am asking about what happens in Python interpreter? Why is there a
> difference between running one line like "a=1;b=1" and two lines like "a=1 \n
> b=1"? Does it decide to locate memory in different types depend on a code?
There is no difference between
Sure, I understand that "is" is not "==", cause "is" just compares id(a)==id(b).
I have a win32 CPython and the range of "singletons" is from -5 to 256 on my
machine.
I am asking about what happens in Python interpreter? Why is there a difference
between running one line like "a=1;b=1" and two
On Thu, Apr 21, 2011 at 7:38 PM, vino19 wrote:
> Hello, I'm a newbie.
> What's the defference between
>
a=-6; b=-6; a is b
True
>
> and
>
a=-6
b=-6
a is b
False
You may want to use the == operator rather than "is". When you use
"is", you're asking Python if the two variabl
Hello, I'm a newbie.
What's the defference between
>>>a=-6; b=-6; a is b
>>>True
and
>>>a=-6
>>>b=-6
>>>a is b
>>>False
?
--
http://mail.python.org/mailman/listinfo/python-list
14 matches
Mail list logo