[New-bugs-announce] [issue22268] mrohasattr and mrogetattr
Gregory Salvan
report at bugs.python.org
Mon Aug 25 00:17:47 CEST 2014
New submission from Gregory Salvan:
It's a small refactoring.
Lurking at collections.abc I found a lot of:
>>> any(attr in B.__dict__ for B in C.__mro__)
also repeated in typing.py of mypy:
https://github.com/JukkaL/mypy/blob/master/lib-typing/3.2/typing.py#L117
It seems to be a common operation to check or get an attribute from mro in abc, so I thought it could help to have dedicated functions to enhance readability.
(see patch e.g. Hash.__subclasshook__ takes 1 line intead of 7...)
----------
components: Library (Lib)
files: mroattr.patch
keywords: patch
messages: 225842
nosy: Gregory.Salvan
priority: normal
severity: normal
status: open
title: mrohasattr and mrogetattr
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file36458/mroattr.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22268>
_______________________________________
More information about the New-bugs-announce
mailing list