My first Python program

Seebs usenet-nospam at
Wed Oct 13 18:59:27 CEST 2010

On 2010-10-12, Hallvard B Furuseth <h.b.furuseth at> wrote:
>> list = map(lambda x:, self.args)
>> return ', '.join(list)
>   return ', '.join([ for x in self.args])

I think I wrote that before I found out about list comprehensions.  How
new are list comprehensions?

I do like that, it's clearer.

>> self.type, = None, None

> Actually you can write self.type = = None,
> though assignment statements are more limited than in C.
> (And I think they're assigned left-to-right.)


>>  match = re.match('(.*)\(\*([a-zA-Z0-9_]*)\)\((.*)\)', text)

> Make a habit of using r'' for strings with lots of backslashes,
> like regexps.

Hmm.  There's an interesting question -- does this work as-is?  I'm
assuming it must or it would have blown up on me pretty badly, so
presumably those backslashes are getting passed through untouched
already.  But if that's just coincidence (they happen not to be valid
\-sequences), I should definitely fix that.

Copyright 2010, all wrongs reversed.  Peter Seebach / usenet-nospam at <-- lawsuits, religion, and funny pictures <-- get educated!
I am not speaking for my employer, although they do rent some of my opinions.

More information about the Python-list mailing list