[Python-ideas] inspect.getclassdistance
Chris Angelico
rosuav at gmail.com
Mon Jan 5 13:30:28 CET 2015
On Mon, Jan 5, 2015 at 11:09 PM, Andrew Barnert
<abarnert at yahoo.com.dmarc.invalid> wrote:
> Also, it seems like it would be simpler to just create a general inheritance-BFS-walker function that yields each base as it goes, which would allow you to write this function as a one-liner.
>
def bfs_bases(cls):
"""Yield the base which are belong to us"""
yield from cls.__bases__
for cls in cls.__bases__:
yield from bfs_bases(cls)
:)
ChrisA
More information about the Python-ideas
mailing list