Can anybody show me a better looking alternative for this elif
structure ?
http://code.google.com/p/appwsgi/source/browse/appwsgi/wsgi/appointment.wsgi
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, Sep 17, 2009 at 12:38 PM, gert gert.cuyk...@gmail.com wrote:
Can anybody show me a better looking alternative for this elif
structure ?
Use a dictionary with functions as values. For example:
#untested obviously
def admin_remove(db, v, gid):
db.execute(DELETE FROM appointments
gert wrote:
Can anybody show me a better looking alternative for this elif
structure ?
http://code.google.com/p/appwsgi/source/browse/appwsgi/wsgi/appointment.wsgi
Where you have cascaded ifs based on a single value, one alternative is
to use a dict where the test value is the key and
On Sep 17, 9:48 pm, Chris Rebert c...@rebertia.com wrote:
On Thu, Sep 17, 2009 at 12:38 PM, gert gert.cuyk...@gmail.com wrote:
Can anybody show me a better looking alternative for this elif
structure ?
Use a dictionary with functions as values. For example:
#untested obviously
def
On Sep 17, 2:38 pm, gert gert.cuyk...@gmail.com wrote:
Can anybody show me a better looking alternative for this elif
structure ?
http://code.google.com/p/appwsgi/source/browse/appwsgi/wsgi/appointme...
For starters assign v['cmd'] to a variable instead of looking it up
every time!
cmd =
On Sep 17, 9:48 pm, Chris Rebert c...@rebertia.com wrote:
On Thu, Sep 17, 2009 at 12:38 PM, gert gert.cuyk...@gmail.com wrote:
Can anybody show me a better looking alternative for this elif
structure ?
Use a dictionary with functions as values. For example:
#untested obviously
def
On Sep 18, 12:09 am, gert gert.cuyk...@gmail.com wrote:
On Sep 17, 9:48 pm, Chris Rebert c...@rebertia.com wrote:
On Thu, Sep 17, 2009 at 12:38 PM, gert gert.cuyk...@gmail.com wrote:
Can anybody show me a better looking alternative for this elif
structure ?
Use a dictionary with
On Thu, Sep 17, 2009 at 3:09 PM, gert gert.cuyk...@gmail.com wrote:
On Sep 17, 9:48 pm, Chris Rebert c...@rebertia.com wrote:
On Thu, Sep 17, 2009 at 12:38 PM, gert gert.cuyk...@gmail.com wrote:
Can anybody show me a better looking alternative for this elif
structure ?
Use a dictionary
On Sep 18, 12:12 am, gert gert.cuyk...@gmail.com wrote:
On Sep 18, 12:09 am, gert gert.cuyk...@gmail.com wrote:
On Sep 17, 9:48 pm, Chris Rebert c...@rebertia.com wrote:
On Thu, Sep 17, 2009 at 12:38 PM, gert gert.cuyk...@gmail.com wrote:
Can anybody show me a better looking