does python support overloaded methods?(py newbie)
Michael Kelly
mkelly2002NOSPAM at earthlink.net
Mon Dec 31 17:28:44 EST 2001
On Mon, 31 Dec 2001 16:52:16 -0000, "karthik_tamu"
<karthik_guru at rediffmail.com> wrote:
>wanted to confirm this. Overloading method names(with parameters
>belonging to different types) is possible in python??.
Hmmmm, seems like this is a bigger deal in compiled
languages since it's usually more hassle to deal with
an indefinite number of arguments. Scripting languages
often have some catch-all syntax to get all the rest of
the args.
In your example avoiding an "if tree" might consist
of a dictionary with currency type as key and procedures
to manipulate that type as the value. Then you would
just call it:
dollars = currency_calc[SomeCurrencyType].(some_amount)
Mike
--
"I don't want to belong to any club that would have me as a member."
-- Groucho Marx
More information about the Python-list
mailing list