Function override?

David C. Ullrich ullrich at math.okstate.edu
Sat Apr 1 13:45:49 EST 2000


Andrew Dalke wrote:

> David C. Ullrich wrote:
> >    This is certainly one of the things that _I_ find keen,
> >amyway - I hope the people who are talking about adding
> >stricter typing to Python make it optional somehow. There
> >are obvious advantages to stricter typing but you lose
> >something as well. (For example, I get a big kick out of
> >the fact that exactly the  same euclidean-algorithm code
> >works to find the GCD of two integers or the GCD of
> >two polynomials. Etc.)
>
> I went to a talk by Stepanov about the Standard Template
> Library in C++.  One of his examples was a geneic GCD
> algorithm which works on integers and polynomials.  Thus,
> stricter typing and generic programming don't have to
> be the same thing.

    Either I have the meaning of some of the terms backwards
or there was a typo in that last sentence. Did you really mean
something like "Thus, stricter typing and generic programming
need not be incompatible" or something?
    If you meant what you wrote I've got the meaning of at
least one of the words backwards. If you meant more or less
what I conjecture you meant: I didn't mean to say anything
about C++, I know nothing about it. Just meant to point
out that a person could do "generic" programming in
Python very easily.

>
> In Python, this could be done by a syntax requiring not
> that "i" and "j" are ints, but that type(i) == type(j).
>
>                     Andrew
>                     dalke at acm.org




More information about the Python-list mailing list