[Python-ideas] Override dict.__new__ to raise if cls is not dict; do the same for str, list, etc.
rosuav at gmail.com
Fri Apr 22 09:34:01 EDT 2016
On Fri, Apr 22, 2016 at 11:24 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> It looks like there *is* a missing detail in the data model docs in relation
> to this, though:
> should state explicitly that the namespace contents are copied to a plain
> dict (which is then never exposed directly to Python code), but it doesn't.
Okay, that explains my confusion, at least :) I can't think of any
situations where I actually *want* a dict subclass (__getattr[ibute]__
or descriptors can do everything I can come up with), but it'd be good
to document that that's not possible.
More information about the Python-ideas