a little parsing challenge ☺

Thomas Boell tboell at domain.invalid
Sun Jul 17 11:49:11 EDT 2011


On Sun, 17 Jul 2011 02:48:42 -0700 (PDT)
Raymond Hettinger <python at rcn.com> wrote:

> On Jul 17, 12:47 am, Xah Lee <xah... at gmail.com> wrote:
> > i hope you'll participate. Just post solution here. Thanks.
> 
> http://pastebin.com/7hU20NNL

I'm new to Python. I think I'd have done it in a similar way (in any
language). Your use of openers/closers looks nice though. In the
initialization of openers, I guess you implicitly create a kind of
hash, right? Then the 'in' operator checks for the keys. That is elegant
because you have the openers and closers right next to each other, not
in separate lists.

But why do you enumerate with start=1? Shouldn't you start with index 0?





More information about the Python-list mailing list