Terry J. Reedy <[email protected]> added the comment:
"IOBase" is a public name and IOBase has an __init__ method. It definitely has
a public constructor. However, like other abstract base classes, it is not
meant to be directly instantiated by users other than writers of other classes.
Ditto for the 3 other io ABCs. Because this is generic to all ABCs, it need
not be repeated for each.
The proposed replacement is the opposite of the truth. Rather than accepting
no arguments, IOBase, like the ABCs in numbers and collections.abc, has a
generic signature and accepts any arguments (which I believe are ignored).
>>> io.IOBase.__init__.__text_signature__
'($self, /, *args, **kwargs)'
>>> io.IOBase(3, a=5)
<io.IOBase object at 0x000001CF6A13D6C0>
A class, such as `object`, accepting no arguments other that self raises. (At
one time, object had the generic signature above.)
>>> object(3)
Traceback (most recent call last):
File "<pyshell#9>", line 1, in <module>
object(3)
TypeError: object() takes no arguments
I think that the fix should be to delete the original incorrect statement and
not replace it with another incorrect statement.
Most abstract base classes are in collections.abc and numbers. They are not
specifically labelled 'abstract base class' in their docstrings because they
are in modules consisting more or less entirely of ABCs. Since io is mostly a
module of concrete classes, I think it appropriate to specifically label them,
as they are now. Once so labeled, nothing need be added that is true of all
ABCs.
----------
title: [doc] "there is no public constructor" should be reworded in io module
documentation -> [io doc] Reword "there is no public constructor"
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue25415>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com