[Tutor] Re: Re: Factory classes (etc)
Erik Price
erikprice@mac.com
Sat, 7 Sep 2002 09:47:24 -0400
On Friday, September 6, 2002, at 09:21 PM, Arthur wrote:
> I am not "missing" method overloading in the sense that I feel Python
> is
> somehow deficient by not having it built-in. Because in fact I don't
> see
> anything
> very deep about method overloading at all. It's just about what
> things are
> called, not what they do. There is the simple option of giving 2
> classes
> that take different arguments different names, and having an API
> defined
> accordingly. As well as numbers of other options.
I was under the impression that method overloading becomes important
when you are using late binding at runtime (I think that's what it's
called). In other words, if you aren't certain exactly what data will
be handed to an object so you take into account multiple kinds of
messages and write methods for each situation that you believe will be
encountered in your program.
You might have no idea what some kind of data will be, you just want to
be prepared for whatever is likely so you code methods to handle these
situations. This lets your class be truly encapsulated (you do not
depend on the structure of the rest of the program to determine what
messages the object can and cannot receive because you might even use
this class in another program!).
In other words it becomes crucial (for strongly typed languages) when
you want to use things like polymorphism.
Erik
--
Erik Price
email: erikprice@mac.com
jabber: erikprice@jabber.org