My first Python program
Ethan Furman
ethan at stoneleaf.us
Wed Oct 13 13:28:55 EDT 2010
Seebs wrote:
> On 2010-10-12, Hallvard B Furuseth <h.b.furuseth at usit.uio.no> wrote:
>
>>> self.type, self.name = None, None
>
>> Actually you can write self.type = self.name = None,
>> though assignment statements are more limited than in C.
>> (And I think they're assigned left-to-right.)
Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
--> a = 2
--> b = 7
--> c = 13
--> a = b = c = 'right to left'
--> a, b, c
('right to left', 'right to left', 'right to left')
>>> 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.
Unknown backslash sequences are passed through as-is.
~Ethan~
More information about the Python-list
mailing list