Experiences/guidance on teaching Python as a first programming language

Gregory Ewing greg.ewing at canterbury.ac.nz
Thu Dec 19 06:39:35 CET 2013

Roy Smith wrote:
> even 
> if you've got all the signatures of foo() in front of you, it can 
> sometimes be hard to figure out which one the compiler will pick.

And conversely, sometimes the compiler will have a hard
time figuring out which one you want it to pick!

I had an experience in Java recently where a library
author had provided two overloads of a function, that
at first sight could be disambiguated by argument types.
But for a certain combination of types it was
ambiguous, and I was unlucky enough to want to use that
particular combination, and the compiler insisted on
picking the wrong one. As far as I could see, it was
*impossible* to call the other overload with those
parameter types.

I ended up resorting to copying the whole function and
giving it another name, just so I could get it called.

Function overloading: Just say no.

More information about the Python-list mailing list