[New-bugs-announce] [issue22032] Use __qualname__ together with __module__

Serhiy Storchaka report at bugs.python.org
Tue Jul 22 11:02:36 CEST 2014

New submission from Serhiy Storchaka:

Often when class name is reported in stdlib (e.g. in reprs), it used together with module name: '%s.%s' % (self.__class__.__module__, self.__class__.__name__). But this code is wrong when a class is nested. The __qualname__ attribute should be used instead of just __name__ (and it is already used in multiple places).

Proposed patch replaces __name__ to __qualname__ when it used together with module name to format full class name.

components: Library (Lib)
files: repr_qualname.diff
keywords: patch
messages: 223649
nosy: serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Use __qualname__ together with __module__
type: behavior
versions: Python 3.4, Python 3.5
Added file: http://bugs.python.org/file36026/repr_qualname.diff

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list