[issue14092] __name__ inconsistently applied in class definition

Lex Berezhny report at bugs.python.org
Thu Feb 23 00:29:08 CET 2012


New submission from Lex Berezhny <eukreign at gmail.com>:

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__ and others:

>>> class F:
	__module__ = "mod"
	
>>> F.__module__
'mod'
>>> F
<class mod.F at 0x0212B360>

----------
components: Interpreter Core
messages: 154013
nosy: eukreign
priority: normal
severity: normal
status: open
title: __name__ inconsistently applied in class definition
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14092>
_______________________________________


More information about the Python-bugs-list mailing list