This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Takuo Matsuoka
Recipients Takuo Matsuoka, steven.daprano
Date 2022-03-28.04:01:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1648440077.3.0.768649626811.issue47136@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2022-03-28 04:01:17Takuo Matsuokasetrecipients: + Takuo Matsuoka, steven.daprano
2022-03-28 04:01:17Takuo Matsuokasetmessageid: <1648440077.3.0.768649626811.issue47136@roundup.psfhosted.org>
2022-03-28 04:01:17Takuo Matsuokalinkissue47136 messages
2022-03-28 04:01:17Takuo Matsuokacreate