[issue34635] inspect: add tools for inspecting subclasses

2018-09-13 Thread Benjamin Mintz


Change by Benjamin Mintz :


--
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34635] inspect: add tools for inspecting subclasses

2018-09-13 Thread Petr Viktorin


Petr Viktorin  added the comment:

__subclasses__ is, as Tim Peters put it [0], "just Python exposing an
internal mechanism for the morbidly curious".
I'd expect that not all alternative implementations of Python have something 
like __subclasses__ -- it's a detail of the implementation (as opposed to the 
MRO, which is something any implementation of the Python language needs to be 
able to compute).
It certainly is cool functionality, but keep in mind we'd have to support it 
for decades, and it would put pressure on other Python implementations to add 
something like __subclasses__.

With that in mind, and because there's no real use case, I think it's better to 
not add this to inspect.

[0] https://mail.python.org/pipermail/python-list/2003-August/210297.html

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34635] inspect: add tools for inspecting subclasses

2018-09-13 Thread Benjamin Mintz


Benjamin Mintz  added the comment:

I didn't have one in mind. I just noticed that there was a getmro which 
accessed __mro__ but no corresponding method for __subclasses__.
That got me getsubclasses and getallsubclasses.

Then I thought it would be cool if you could walk the tree of subclasses in 
code, so I wrote getsubclasstree.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34635] inspect: add tools for inspecting subclasses

2018-09-13 Thread Petr Viktorin


Petr Viktorin  added the comment:

What's the use case for these?

--
nosy: +petr.viktorin

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34635] inspect: add tools for inspecting subclasses

2018-09-11 Thread Zachary Ware


Change by Zachary Ware :


--
nosy: +yselivanov

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34635] inspect: add tools for inspecting subclasses

2018-09-11 Thread Benjamin Mintz


Change by Benjamin Mintz :


--
keywords: +patch
pull_requests: +8623
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34635] inspect: add tools for inspecting subclasses

2018-09-11 Thread Benjamin Mintz


New submission from Benjamin Mintz :

Adds inspect.getsubclasses, inspect.getallsubclasses (recursive), and 
inspect.getsubclasstree (recursive, maintains structure).

See documentation for more details.

--
components: Library (Lib)
messages: 325068
nosy: bmintz
priority: normal
severity: normal
status: open
title: inspect: add tools for inspecting subclasses
type: enhancement
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com