[issue14092] __name__ inconsistently applied in class definition

2012-02-24 Thread Terry J. Reedy
Terry J. Reedy added the comment: This is not a bug report, as Python works as documented. Double underscore names are defined as *reserved* for the interpreter, with the ones actually in use having defined meanings. type.__new__ sets several internally used attributes on new classes. The at

[issue14092] __name__ inconsistently applied in class definition

2012-02-22 Thread Lex Berezhny
Lex Berezhny added the comment: I don't particularly need this functionality. It was just something that seemed counter intuitive to me. I discovered this while working on a python to javascript compiler. I'll probably implement the compiler to allow overriding with __name__ as it seems mor

[issue14092] __name__ inconsistently applied in class definition

2012-02-22 Thread Benjamin Peterson
Benjamin Peterson added the comment: It can be implemented but I'm skeptical that it's correct. You might try convincing Python-dev. -- ___ Python tracker ___ _

[issue14092] __name__ inconsistently applied in class definition

2012-02-22 Thread Lex Berezhny
Lex Berezhny added the comment: The one in __name__ since logically that happens after the class declaration ('class X' line) and should overwrite the name in the class declaration. -- ___ Python tracker

[issue14092] __name__ inconsistently applied in class definition

2012-02-22 Thread Benjamin Peterson
Benjamin Peterson added the comment: Well, what do you expect the name of the class to be? The one you assign __name__ to or the one you pass to type()? -- ___ Python tracker _

[issue14092] __name__ inconsistently applied in class definition

2012-02-22 Thread Lex Berezhny
Lex Berezhny added the comment: I think for __class__ it might make sense but for __name__ it seems not intuitive. -- ___ Python tracker ___ ___

[issue14092] __name__ inconsistently applied in class definition

2012-02-22 Thread Benjamin Peterson
Benjamin Peterson added the comment: I don't think this is actually incorrect. Basically setting something in the class body is not equivalent to setting it as an attribute on the class. This happens with other attributes. Consider >>> class X: ... __class__ = list ... >>> X.__class__ >

[issue14092] __name__ inconsistently applied in class definition

2012-02-22 Thread Lex Berezhny
Changes by Lex Berezhny : -- versions: +Python 3.3 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.

[issue14092] __name__ inconsistently applied in class definition

2012-02-22 Thread Lex Berezhny
New submission from Lex Berezhny : The following behavior doesn't make sense, especially since it works correctly for other special attributes: >>> class F: __name__ = "Foo" >>> F.__name__ 'F' >>> F().__name__ 'Foo' >>> F.__name__ = 'Foo' >>> F.__name__ 'Foo' Works fine for __module_