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 <rep...@bugs.python.org>
<http://bugs.python.org/issue22268>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to