[Tutor] What on earth is happening here ???
Steven D'Aprano
steve at pearwood.info
Thu Jul 26 03:34:21 CEST 2012
Alan Gauld wrote:
>> def getDOMDocument(self):
>> def getDOMDocument(self, namespaceUri=__defaultNamespaceUri):
>> def getDOMDocument(self, namespaceUri=__defaultNamespaceUri,
>> qualifiedName=__defaultQualifiedName):
> > def getDOMDocument(self,
> namespaceUri=__defaultNamespaceUri,
> qualifiedName=__defaultQualifiedName,
> docType=__defaultDoctype):
>
> These definitions all define the same object. There is no function
> overloading in Python. You can often fake it with suitable use of
> default arguments. This looks likely here.
Another alternative is the generics implementation from pkgutil:
from pkgutil import simplegeneric
See the source code for details -- simplegeneric is public but undocumented.
From time to time people make noise about documenting it and moving it into
its own module, but this is volunteer-driven and it hasn't happened yet.
--
Steven
More information about the Tutor
mailing list