is there a difference between one line and many lines

Heiko Wundram modelnine at modelnine.org
Thu Apr 21 11:59:36 CEST 2011


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 the two.

You've not given the initializers for a/b in the two statement groups
you showed, so that what Chris Angelico said is probably what's
happening here (i.e.: in the first case, you stay in the singleton
range, in the second case which builds on the first, you don't).

-- 
--- Heiko.



More information about the Python-list mailing list