Author eric.snow
Recipients Rosuav, eric.snow, inada.naoki, rhettinger, serhiy.storchaka, steve.dower
Date 2018-09-20.16:17:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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):
      def __prepare__(meta, name, bases, **kwargs):
          return OrderedDict()

  class Spam(metaclass=Meta):
      a = 1
      b = 2


Just keep in mind that neither of those is specific to PEP 520.
Date User Action Args
2018-09-20 16:17:17eric.snowsetrecipients: + eric.snow, rhettinger, inada.naoki, Rosuav, serhiy.storchaka, steve.dower
2018-09-20 16:17:17eric.snowsetmessageid: <>
2018-09-20 16:17:17eric.snowlinkissue34320 messages
2018-09-20 16:17:17eric.snowcreate