[Edu-sig] re: Does edu-sig extend to Jython

Arthur ajs@ix.netcom.com
Mon, 19 Aug 2002 17:31:43 -0400


Dethe writes -

>>Don't be too quick to take this off-list.

I'm game.

>While your situation is pretty specific, the general case of "why doesn't
Python support feature
>X of language Y" seems to be appropriate here.  There are several
>possible answers, all valuable in an educational context:

>1) It does support X, but the python idiom looks like X()
>.2) X isn't needed because of python feature Z
>3) Python doesn't support X because X is a bad idea for such and such a
>reason
>4) Python doesn't support X, but you can do Z to simulate it

I would think as to method overloading we are in the realm of 4).

>In your case, if both Line and Point have methods getHalfIntersection(),
>could you then have:

>def intersection(first, second):
>  return first.getHalfIntersection() * second.getHalfIntersection()

I get the gist of your suggestion, but the issue is pervasive and
might overly tax my ingenuity.

My current thinking is this:

I need some testing of the arguments and some decent error
reporting for inappropriate arguments, in any case. Right now
you send a Line where the class needs a Plane, and somewhere down the
pike you'll probably get a message about object x not having
an attribute "normal" let's say -which Planes's have and Line's
don't.  For me, as a user, I pretty now where to go. For
someone else, as a user, it would be a mystery.

(Again, I am assuming this is a necessary byproduct of dynamic
typing.  I believe that Java would give an error message on
construction that would be specific enough to allow me to forego
some of this.  OTOH, I went through the process far enough to
understand some of what the dynamic typing of Python is
*giving* me and *saving* me versus Java's typing methodology
to know not to resent - more than just a little - what it might
be costing me. I could elaborate with specifics, but won't)

And in doing some real error catching and reporting on arguments,
I would expect isinstance will come into play, and in
doing it, it should not be very much additional burden to
do it in such a way so that at least I can make argument
order irrelevant.

After that I guess I need to see where I am, and then take the more
complex issues of this kind on a case by case basis - there
probably is no one-size answer for all cases.

Art