R
Roy Smith
I've got a method which returns another method:
class domPrinter:
def getNodePrinter (self, nodeType):
[...]
# return domPrinter.printUnknown
return self.__class__.printUnknown
I originally wrote it as the commented-out version, but didn't like
the idea that I've got to repeat the class name. The version using
self.__class__ solves that problem, but it's uglier and more
complicated.
Any opinions on the best way to do this?
class domPrinter:
def getNodePrinter (self, nodeType):
[...]
# return domPrinter.printUnknown
return self.__class__.printUnknown
I originally wrote it as the commented-out version, but didn't like
the idea that I've got to repeat the class name. The version using
self.__class__ solves that problem, but it's uglier and more
complicated.
Any opinions on the best way to do this?