[issue17279] Document which named built-in classes can be subclassed
Terry J. Reedy added the comment: From the current python-ideas 'range' thread: Me: Would it be correct to say (now) that all 4 are intentional omissions? and not merely oversights? Nick: Yes, I think so. People will have to be *real* convincing to explain a case where composition isn't a more appropriate solution. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17279 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17279] Document which named built-in classes can be subclassed
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17279 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17279] Document which named built-in classes can be subclassed
Changes by Chris Rebert pyb...@rebertia.com: -- nosy: +cvrebert ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17279 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17279] Document which named built-in classes can be subclassed
Terry J. Reedy added the comment: Such a list might differentiate between classes that are intentionally not subclassed and those for which subclassing simply has not yet been enabled. That might help eliminate the latter list. When I suggested on the python-ideas 'range' thread that people should best get what they wanted with a range subclass, if that were made possible, Nick C. replied I wasn't even aware you *couldn't* subclass it (I'd never tried).. Indeed, why would he with no doc. The types module doc could also use an addition. Attached subclassable.py produces these lists: Among named builtin classes, these cannot be subclassed: bool, memoryview, range, slice, Among types classes, these can be subclassed: ModuleType, SimpleNamespace, -- Added file: http://bugs.python.org/file29216/subclassable.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17279 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17279] Document which named built-in classes can be subclassed
Terry J. Reedy added the comment: The list given is for 3.3. 3.2 and 2.7 do not have SimpleNamespace. I do not have and currently cannot build 3.4 to test, but as of this moment, I expect it to be the same. In 2.7, range is xrange. Its types module includes aliases for builtins, such as IntType, so Among classes that do not have built-in names would need to be prefixed. I simple sentence for types should be easy to place. I am not sure about the built-ins list. The bool entry already has Class bool cannot be subclassed further. Its only instances are False and True (see Boolean Values)., so a general list would be repeating that part. I am thinking of a minimal sentence for the other three entries. This class cannot be subclassed. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17279 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17279] Document which named built-in classes can be subclassed
New submission from Terry J. Reedy: More than once, people have noted on python-list that not all built-in classes can be subclassed and that there seems to be no way to find out which, other than to try each. (Today, Daniel Urban pointed out the CPython-specific 'xx.__flags__ (1 10)'.) If the specifics are a Python feature, rather than CPython specific, I think they should be given in the doc. There is a recent issue, which I cannot find, about re-organizing the Library built-in functions chapter by groups. If this is done, it would be easy to add, in the introduction to built-in classes, a list of which of the named classes can or cannot be subclassed (whichever list is shorter) and note that those not in builtins cannot be.) -- assignee: docs@python components: Documentation messages: 182703 nosy: docs@python, terry.reedy priority: normal severity: normal stage: needs patch status: open title: Document which named built-in classes can be subclassed type: enhancement versions: Python 2.7, Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17279 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17279] Document which named built-in classes can be subclassed
Changes by Daniel Urban urban.dani...@gmail.com: -- nosy: +daniel.urban ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17279 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com