Eric Snow <[email protected]> added the comment:
FWIW, the PEP 520 example isn't exactly right. PEP 520 is about the class
definition namespace, not the namespace object passed to type(). That always
does the right thing, since the default class definition namespace is dict
(which happens to be ordered in 3.6+).
That said, a test that explicitly calls type() with an OrderedDict, as you have
shown, is still a good idea since type() always changes the namespace to a dict.
Perhaps another good test of the same thing would be with a metaclass that
returns an OrderedDict from __prepare__():
class Meta(type):
@classmethod
def __prepare__(meta, name, bases, **kwargs):
return OrderedDict()
class Spam(metaclass=Meta):
a = 1
b = 2
Spam.__dict__
Just keep in mind that neither of those is specific to PEP 520.
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue34320>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com