You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.2 KiB

From: adustman at (Andy Dustman)
Date: Mon, 12 Apr 1999 23:06:08 GMT
Subject: role of semilcolon
In-Reply-To: <>
References: <>
Message-ID: <>
X-UID: 149
On 12 Apr 1999, Reuben Sumner wrote:
> In the python interpreter doing 'a=1;b=2;b=3' does what I would
> expect, three seperate assignments. However ; doesn't seem to appear
> in the language reference except in the list of delimeters. Is the
> above example formally valid python?
Semicolon is a statement separator. So is the end of line unless you have
open parentheses, brackets, braces, or triple-quotes. So:
is the same as:
But a Pythonism you may want to adapt is:
a,b,c = 1,2,3
In practice, semicolon is rarely used in Python, since the end of line
separates statements just as well with one less byte (none vs. one :), and
multiple assignments can be done as above.
andy dustman | programmer/analyst | comstar communications corporation
telephone: 770.485.6025 / 706.549.7689 | icq: 32922760 | pgp: 0xc72f3f1d