two ideoms at one blow: line-reading and regexp-matching

Russell Nelson nelson at crynwr.com
Wed Feb 20 10:29:11 EST 2002


Simon Brunning writes:
 > for line in file:
 >     line.whatever()

Cool.  Good reason to upgrade to 2.2.

 > >     matched = re.match(r'egexp(.*)', line)
 > >     if matched:
 > >         print matched.group(1)
 >  
 > Assignments and expressions are different things in Python...

Indeed, and that's a good thing.  But I'm proposing an alternate
syntax for the if statement, specifically:
	"if" <variable> "=" <expression":.

-- 
-russ nelson              http://russnelson.com | Crypto without a threat
Crynwr sells support for free software  | PGPok | model is like cookies
521 Pleasant Valley Rd. | +1 315 268 1925 voice | without milk.
Potsdam, NY 13676-3213  | +1 315 268 9201 FAX   | 




More information about the Python-list mailing list