<div dir="ltr"><div dir="ltr"><div>Thanks for clarification that `type.__subclasses__` is remaining.</div><div><br></div><div>I submitted a bug request to document `type.__subclasses__`</div><div><br></div><div>URL: <a href="https://bugs.python.org/issue35106">https://bugs.python.org/issue35106</a></div><div><br></div><div>(Hopefully I did it correctly, as I am just learning how to submit python bugs).<br></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Oct 29, 2018 at 2:15 PM Guido van Rossum <<a href="mailto:guido@python.org">guido@python.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">__subclasses__ is a runtime thing. As such it should probably be documented -- someone should submit a doc PR. I don't think that "overhaul" is the right word to describe what's going to happen with types in Python -- yes, we're adding optional static type checking, and yes, this will occasionally result in changed recommendations for how the language should be used or how APIs should be designed, but no, this does not mean that we're planning to deprecate or remove existing runtime features.<br></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Oct 29, 2018 at 11:12 AM Joy Diamond <<a href="mailto:python.gem@gmail.com" target="_blank">python.gem@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Greetings,</div><div><br></div><div>Currently `type.__subclasses__` is not documented at <a href="http://docs.python.org" target="_blank">docs.python.org</a> (and works in both python 2 & python 3).<br></div><div></div><div>
<div><br></div><div>I would like to keep `.__subclasses__` and have it documented at <a href="http://docs.python.org" target="_blank">docs.python.org</a>.</div><div><br></div><div>Is there a reason it is not documented?</div><div><br></div><div>I realize the whole type system is going an overhaul, and the concept of what is "subclass" of another class is a complicated issue.</div><div><br></div><div>See for example: <a href="https://github.com/python/typing/issues/135" target="_blank">https://github.com/python/typing/issues/135</a> which talks about the complexity of deciding subclassing.<br></div><div><br></div><div>I think though, despite the overall, `types.__subclasses__` should be kept & documented.<br></div><div><br></div><div>Thanks,</div><div><br></div><div>Joy Diamond.</div><div><br></div><div>1.  The google search: "site:<a href="http://docs.python.org" target="_blank">docs.python.org</a> __subclasses__" finds no instances of the word "__subclasses__"<br></div></div><div><br></div><div>2.  As for what the function does, it returns the subclasses of a class:<br></div><div><br></div><div>Consider the following program:</div><div><br></div><div>class CryptographicActors(object): pass<br>class Alice(CryptographicActors): pass<br>class Bob(CryptographicActors): pass<br><br>print("CryptographicActors subclases: %s" % CryptographicActors.__subclasses__())<br><br>help(CryptographicActors.__subclasses__)</div><div><br></div><div>3.  It properly prints out:</div><div><br></div><div>CryptographicActors subclases: [<class '__main__.Alice'>, <class '__main__.Bob'>]</div><div><br></div><div>Showing the two subclasses (`Alice` and `Bob`)<br></div><div><br></div><div>4. The internal documentation explains "__subclasses__() -> list of immediate subclasses"</div><div><br></div><div>To fully figure out what it did, I had to read the source code to Python -- which really is not the best way to figure out what a function does; hence the request to document it (and indicate it's future existence in python)<br></div></div></div></div></div></div></div>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/codeofconduct/</a><br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="m_-8691728140788264897gmail_signature" data-smartmail="gmail_signature">--Guido van Rossum (<a href="http://python.org/~guido" target="_blank">python.org/~guido</a>)</div>
</blockquote></div>