[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Tabs v.s. spaces

Cameron Patrick wrote:
I don't think it is.  Python doesn't have a switch/case equivalent.  It'd
have to be done with a bunch of if's or something.

    Well, depends.  Do you consider its dictionary to be a switch?

>>> def foo():
...     print "foolio"
>>> def bar():
...     print "bario"
>>> baz = {'foo':foo, 'bar':bar}
>>> for x in baz:
...     if baz.has_key(x):
...         baz[x]()
...     else:
...         print 'blorg'

         Steve C. Lamb         | I'm your priest, I'm your shrink, I'm your
       PGP Key: 8B6E99C5       | main connection to the switchboard of souls.

Attachment: pgpwIIZrkl5D9.pgp
Description: PGP signature

Reply to: