Is there a better way of doing this?
steve at REMOVETHIScyber.com.au
Thu Jun 2 17:52:18 CEST 2005
On Mon, 30 May 2005 14:05:36 +0200, Magnus Lycka wrote:
> Steven D'Aprano wrote:
> > print is a statement, not a function. The brackets are syntactically
> > correct, but pointless. Remove them.
>> On Sat, 28 May 2005 13:24:19 +0000, Michael wrote:
>>> while( newNS ):
>> Guido (our Benevolent Dictator For Life and creator of Python) hates
>> seeing whitespace next to parentheses. I agree with him. while(newNS)
>> good, while( newNS ) bad.
> while is a statement, not a function. The brackets are syntactically
> correct, but pointless. Remove them. ;^)
Of course I knew that. I deliberately made that error to see if others
were paying attention. Well done, go to the head of the class. *cough*
> while newNS:
> Not only are they pointless (in both print and while), but they are
> blurring the distinction between statements and callables, and they
> add noise. Only wrap the expression following a statement such as
> while, if, print etc in () if the following expression spans several
Yes, of course you are right. Serves me right for replying to Usenet posts
in the wee hours of the morning.
Although, pardon me for stating the obvious, using brackets for
precedence, or to add clarity by careful grouping, is always allowed even
if the expression doesn't span more than one line.
eg while (index > 0) and (not found or still_working):
More information about the Python-list