Function override?

Andrew Dalke dalke at acm.org
Sat Apr 1 13:28:36 CEST 2000


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.

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