Author eric.snow
Recipients Rosuav, eric.snow, inada.naoki, rhettinger, serhiy.storchaka, steve.dower
Date 2018-09-20.16:15:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1537460108.7.0.956365154283.issue34320@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-09-20 16:16:49eric.snowunlinkissue34320 messages
2018-09-20 16:15:08eric.snowsetrecipients: + eric.snow, rhettinger, inada.naoki, Rosuav, serhiy.storchaka, steve.dower
2018-09-20 16:15:08eric.snowsetmessageid: <1537460108.7.0.956365154283.issue34320@psf.upfronthosting.co.za>
2018-09-20 16:15:08eric.snowlinkissue34320 messages
2018-09-20 16:15:08eric.snowcreate