Sven R. Kunze
srkunze at mail.de
Wed May 17 14:09:33 EDT 2017
On 17.05.2017 08:49, Stephan Houben wrote:
> 2. Not subclassed from tuple. I have been bitten by this subclassing
> when trying to set up
> singledispatch on sequences and also on my classes.
Would it make sense to have a 'simpleobject'? Which basically implements
a NamedTuple constructor but nothing more?
And if you need more __dunder__ magic, have it provided by some mixins?
class Foo(dictlike, tuplelike, simpleobject):
I don't know exactly if some of those dictlike, tuplelike mixins are
already available in the stdlib under a different name, but at least to
me this looks like plug'n'play __dunder__ magic.
More information about the Python-ideas