Is there a way to implement the ** operator on a custom object

Left Right olegsivokon at gmail.com
Fri Feb 9 12:56:17 EST 2024


> Looks like it can simply be done in Python, no tp_as_mapping needed.

It's not that it isn't needed. You've just shown a way to add it using
Python code.

But, more to the point: extending collections.abc.Mapping may or may
not be possible in OP's case.

Also, if you are doing this through inheritance, this seems really
convoluted: why not just inherit from dict? -- less methods to
implement, less stuff to import etc.


More information about the Python-list mailing list