In article <bhff4qf21f...@mid.individual.net>, Gregory Ewing <greg.ew...@canterbury.ac.nz> wrote:
> 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. BTDT. We were doing a huge network management application. There was an SNMP_Manager class, which had three or four different constructors, each one taking a dozen or more arguments, many of them optional. I finally got fed up with eternally trying to figure out which constructor was being called and replaced them with a series of factory functions: construct_for_traps(), construct_for_polling(), etc. -- https://mail.python.org/mailman/listinfo/python-list