[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:

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>

More information about the New-bugs-announce mailing list