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

Patrick K. O'Brien pobrien@orbtech.com
Mon, 19 Aug 2002 15:45:13 -0500


[Dethe Elza]
>
> In your case, if both Line and Point have methods getHalfIntersection(),
> could you then have:
>
> def intersection(first, second):
>   return first.getHalfIntersection() * second.getHalfIntersection()
>
> where "*" is replace with the real operation or set of operations needed
> and getHalfIntersection is replaced with whatever is specific to lines
> and/or points?

Good point. Here is another very simple (and contrived) example as further
support of your point:

>>> def dup(first, second):
...     return first * second
...
>>> dup(3, "this")
'thisthisthis'
>>> dup("this", 3)
'thisthisthis'
>>>

--
Patrick K. O'Brien
Orbtech
-----------------------------------------------
"Your source for Python programming expertise."
-----------------------------------------------
Web:  http://www.orbtech.com/web/pobrien/
Blog: http://www.orbtech.com/blog/pobrien/
Wiki: http://www.orbtech.com/wiki/PatrickOBrien
-----------------------------------------------