Avoiding if..elsif statements
Fredrik Lundh
fredrik at pythonware.com
Fri Aug 25 19:33:15 EDT 2006
More information about the Python-list mailing list
Fri Aug 25 19:33:15 EDT 2006
- Previous message (by thread): Avoiding if..elsif statements
- Next message (by thread): Avoiding if..elsif statements
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"unexpected" <sumesh.chopra at gmail.com> wrote: > However, I'm passing in a few variables, so I can't just take it > out-though every single function would be passing the same variables. > > so something.func() is actually > something.func(string, list) > > How would I modify it to include them? just add the parameters to the call: dispatch[value](string, list) # note: do the call here! in Python, an explicit call is always written as expression(argument list) where expression yields a callable object. in your original case, the expression was a bound method; in the modified example, the expression is a dictionary lookup. the actual call part looks the same way, in both cases. </F>
- Previous message (by thread): Avoiding if..elsif statements
- Next message (by thread): Avoiding if..elsif statements
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list