Method acting on arguements passed
Panos Laganakos
panos.laganakos at gmail.com
Fri May 5 08:27:42 EDT 2006
I want a class method to take action depending on the type of the
arguement passed to it.
ie:
getBook(id) # get the book by ID
getBook(name) # get the book by name
...
Other languages use the term function/method overloading to cope with
this. And when I googled about it seems that GvR is testing it for 3.0
inclusion or so.
I was thinking of right after the function declaration check for the
parameter passed by isinstance() or type() and use if..elif..else to
act.
Is this the pythonic way/best practice to apply here?
More information about the Python-list
mailing list