does python support overloaded methods?(py newbie)

Michael Kelly mkelly2002NOSPAM at earthlink.net
Tue Jan 1 14:48:55 EST 2002


On 31 Dec 2001 23:58:45 -0800, hungjunglu at yahoo.com (Hung Jung Lu)
wrote:

>There are many ways of achieving the things you want to do. But method
>overloading itself is a non-Pythonic concept, since Python is a
>dynamicly-typed language: you don't know, nor do you care about, the
>type of an object until the moment you use it.

Yes, I see no *point* to have a preprocessor turning
BOOL Draw(point x, point y)
BOOL Draw(point a, point b, point c, point d)

into

BOOL Draw_pt_pt
and
BOOL Draw_pt_pt_pt_pt

when in a dynamic language you'd just do
Draw(points)

and draw according to the number of points passed in. :)

Overloading gives you a conceptual aid in a statically
typed compiled language like C++ that's already
built in to dynamically typed languages like Python
Rexx, Ruby, whatever.



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