Takuo Matsuoka <motogeom...@gmail.com> added the comment:
Thank you for your response. I think __name__ here is very different from __len__ . (1) Even if you set __name__ to what should be the right value, e.g., when my class O will be a subclass of say 'type', and __name__ is an appropriate thing for your purposes to override the attribute '__name__' of 'type' objects (held as the entry '__name__' of type.__dict__), the same value is going to be O.__dict__["__module__"] as long as you let __prepare__ of the mataclass C provide it. (2) Even if, in other cases, you do del __name__ at the end of the body of the class O, the problem remains unless you know O.__dict__["__module__"] will be changed anyway. The behaviour is not documented as far as I could see. I think such a behaviour is problematic if it can't be expected from what's documented. If the value of __name__ can be read from the scope outside, then that will erase this unexpected behaviour and I think it would be a much safer thing to do. Thanks. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue47136> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com