is there a difference between one line and many lines
jeanmichel at sequans.com
Thu Apr 21 12:39:13 CEST 2011
> 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 lines like "a=1 \n b=1"? Does it decide to locate memory in different types depend on a code?
Probably, for optimisation purpose I guess. This is very implementation
specific and as a newby, you should not care about such trivial details.
The worst thing on earth you could do would be to code knowing that some
values are singleton and take profit from it. Well, maybe coding in perl
would be worse...
More information about the Python-list