cedmunds at spamless.rochester.rr.com
Sat Nov 15 02:11:47 CET 2003
"Maxim Khesin" <max at cNvOiSsiPoAnMtech.com> wrote in message
news:0latb.95267$ri.14418352 at twister.nyc.rr.com...
> being recently introduced to the joys of programming in a powerful
> dynamic language (go snake!) I periodically rethink which parts of C++ I
> still miss. One thing I really enjoy is the generics of C++ - i think
> they are the single strong benefit of a strongly typed system. I was
> wondering about the possibility of implementing STL-like algorithms in
> Python and the one thing that I cannot think of doing without a kludge
> is the object comparsion that so much of STL relies on, which in turn
> relies on types and function(<) overloading. Is there a way to implement
> something similar in python (short of multimethods?). How does the
> python dictionary object allow arbitrary key types? Is in internally
> using the references' addresses to impose the tree ordering?
The STL (now part of the standard library) does with considerable
complexity* that which Python does very simply. That's because C++ templates
attempt to do generic programming without breaking the type system. Python
has no type system to break so generic program comes naturally.
*if you don't agree with that, I will whack you one with my copy of Josuttis
More information about the Python-list