Pythoncal, anyone? (My (late) beef with Simple Generator syn tax (PEP 255))

Stuart D. Gathman stuart at bmsi.com
Mon Nov 18 15:19:47 EST 2002


On Mon, 18 Nov 2002 10:15:51 -0500, sismex01 wrote:

>> I have an idea: Suppose there were a "don't" statement that could be
>> put in front of another statement to, effectively, comment it out, e.g.
>> 
>>   def foo():
>>     # This function does nothing
>>     don't print "Hello"
>> 
>> Then an empty generator could be written
>> 
>>   def g():
>>     don't yield None

Python already has a "don't" statement.  It is spelled "if 0".

def null(): if 0: yield None

Tested with python-2.2.2, and works perfectly.

-- 
	      Stuart D. Gathman <stuart at bmsi.com>
Business Management Systems Inc.  Phone: 703 591-0911 Fax: 703 591-6154
"Confutatis maledictis, flamis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.



More information about the Python-list mailing list