I need newbie help

Nick Vargish nav+posts at bandersnatch.org
Fri May 14 10:43:11 EDT 2004


Paul McNett <p at ulmcnett.com> writes:

> What's the matter with using if...elif...else:

In the example, I think the advantage is that the dictionary lookup is
data driven. If you want to add a new location, you just extend the
dictionary, which is cleaner than adding another clause to an
if...elif block.

Also, if you want to change the name of a location, you just change
the relevant data -- not the code.

Nick 
 
-- 
#  sigmask  ||  0.2  ||  20030107  ||  public domain  ||  feed this to a python
print reduce(lambda x,y:x+chr(ord(y)-1),' Ojdl!Wbshjti!=obwAcboefstobudi/psh?')



More information about the Python-list mailing list