function returns

Edward Diener eldiener at earthlink.net
Tue Jul 13 02:23:39 CEST 2004


steve holden wrote:
> Bart Nessux wrote:
> Different calls to the same function are quite at liberty to return
> values of different types, although this would usually be considered a
> somewhat perverse way to behave.

I disagree about the last clause. One of the wonderful things about a
dynamically typed language like Python is that one can pass, under the same
parameter name, and return, different types to and from functions. I don't
say it should always be done but it sure comes in handy when one does it,
and it often simplifies code where the need to have different functions
doing almost the same thing is no longer necessary.





More information about the Python-list mailing list