role of semilcolon

Fredrik Lundh fredrik at pythonware.com
Tue Apr 13 03:21:15 EDT 1999


Andy Dustman wrote:
> a=1;b=2;b=3
> 
> is the same as:
> 
> a=1
> b=2
> b=3
> 
> But a Pythonism you may want to adapt is:
> 
> a,b,c = 1,2,3

that's a somewhat dubious pydiom: the semicolon
variant is about twice as fast.

(and unless you use the -O option, the semicolon
form is also faster the one-assignement-per-line
form...)

</F>





More information about the Python-list mailing list