> It seems like it ought to handle subclasses of builtin classes like > string. That's desirable, indeed. I think Skip's concern is primarily how to implement that; that is my concern, atleast. I can think of an implementation that replaces def __dump(self, value): try: f = self.dispatch[type(value)] except KeyError: raise TypeError, "cannot marshal %s objects" % type(value) else: f(self, value) with def __dump(self, value): for t in type(value).__mro__: try: f = self.dispatch[t] except KeyError: pass else: f(self, value) return raise TypeError, "cannot marshal %s objects" % type(value) That has several draw-backs, though: - it does not work with Py 1.5, which /F still requires for xmlrpclib, - it may give ambiguous results, in case an object could act as either of the XML-RPC types (it works deterministic, but may still give the undesired outcome) - it doesn't work for classic classes and instances Can you come up with anything better? Regards, Martin P.S. I don't know whether usage of __mro__ itself would be a bug or a feature. I certainly take pride in coming up with that idea :-)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4