Raymond Hettinger <rhettin...@users.sourceforge.net> added the comment:
class Prepared(type): 'Preload the class with a reference to itself' @classmethod def __prepare__(mcl, name, bases): return {name: type(name, bases, {})} def __new__(mcl, name, bases, mapping): tmpcls = super().__new__(mcl, name, bases, mapping) deferred_class = mapping[name] deferred_class.__dict__.update(tmpcls.__dict__) # XXX need writeable dict_proxy return deferred_class class Graph(metaclass=Prepared): def reverse(self) -> Graph: ... ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue11339> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com