Python syntax in Lisp and Scheme

Marco Antoniotti marcoxa at cs.nyu.edu
Wed Oct 8 16:57:41 EDT 2003


On Wednesday, Oct 8, 2003, at 15:43 America/New_York, David Mertz wrote:

> Marco Antoniotti <marcoxa at cs.nyu.edu> wrote previously:
> |As for your comments on methods and generic functions it is obvious
> |that you do not know what multiple dispatching is (yes, there is an 
> ugly
> |hacked up Python library to do that floating around; I do not know if 
> it
> |will make it it 3.0), so you comment looses value immediately.
>
> This is absolutely replete with ignorance.

I am about to question that.  I mentioned the module from memory as a 
proof of existence.  Yelling "you do not have multimethods in Python" 
would have been wrong.  I didn't.


>   The multimethods module I
> present at:
>
>   http://www-106.ibm.com/developerworks/linux/library/l-pydisp.html
>
> Is neither ugly nor hacked, and is just as general as what you would do
> in Lisp (but with nicer looking syntax).

Well, beauty is in the eye of the beholder.  We lispers usually have 
better tastes :)  I should not have used the "ugly" and "hacked" up 
adjectives.  I apologize for that.

However, while your package does the job, it is not as nice and as well 
integrated with Python as you would like it to be.  Why?  Because you 
(a) do not have macros hence (b) you cannot change what 'def' does. 
AFAIU In your package you MUST write separate dispatching statements 
from method definitions (unless the code block is trivial).

Finally, it is unclear to me how you can achieve the same effects of 
full method combinations in CL under your scheme, given Python rules 
for deciding multiple inheritance issues (DFS does not quite cut it, as 
realized by CLOS and Dylan), and you also do not have the opportunity 
to CALL-NEXT-METHOD within a method definition (at least from what I 
gather from your explanation).

> Neel Krishnaswami, and
> probably other folks, have written similar modules before I did; I 
> don't
> claim to be all that original--it's not that difficult to do, after 
> all.
>
> You can grab it directly, btw, at:
>
>   http://www.gnosis.cx/download/gnosis/magic/multimethods.py
>
> Now OF COURSE, multimethods.py will not "make it into 3.0"--it's not in
> 2.3 or any other version either.  It's a 3rd party library... and it
> will continue to work just fine whenever 3.0 comes out.  Most likely
> with no changes, but I'll update it if needed (unless I get hit by a
> bus, I suppose, but someone else could easily do the same).

Ok.  Fair enough.

Cheers


--
Marco Antoniotti

--
Marco Antoniotti
NYU Courant Bioinformatics Group		tel. +1 - 212 - 998 3488
715 Broadway 10th FL				fax. +1 - 212 - 998 3484
New York, NY, 10003, U.S.A.






More information about the Python-list mailing list