This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2010年11月30日 19:05 by stutzbach, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| io-abc.diff | stutzbach, 2010年11月30日 22:15 | |||
| issue10589.diff | asvetlov, 2012年11月30日 16:26 | |||
| Messages (10) | |||
|---|---|---|---|
| msg122930 - (view) | Author: Daniel Stutzbach (stutzbach) (Python committer) | Date: 2010年11月30日 19:05 | |
The I/O ABC documentation has a blanket disclaimer at the top: "The abstract base classes also provide default implementations of some methods in order to help implementation of concrete stream classes. For example, BufferedIOBase provides unoptimized implementations of readinto() and readline()." Which effectively means that to subclass one of them requires digging into Lib/_pyio.py to figure out which methods provide useful implementations. It would be handy to have a table, similar to the one for the collections ABCs [1], that spells out which methods are provided. [1]: http://docs.python.org/py3k/library/collections.html#abcs-abstract-base-classes I hope to have a patch ready sometime within the next week. |
|||
| msg122940 - (view) | Author: Daniel Stutzbach (stutzbach) (Python committer) | Date: 2010年11月30日 22:15 | |
+io and doc people Attached is a simple patch to add a table to the documentation summarizing the I/O ABCs. |
|||
| msg122943 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2010年11月30日 22:26 | |
What does "unsupported" mean? "Abstract" would look more exact. |
|||
| msg122944 - (view) | Author: Georg Brandl (georg.brandl) * (Python committer) | Date: 2010年11月30日 22:28 | |
Not sure what "unsupported methods" means. E.g. "readinto" is listed as provided by RawIOBase in the doc text. |
|||
| msg122948 - (view) | Author: Daniel Stutzbach (stutzbach) (Python committer) | Date: 2010年11月30日 22:36 | |
> What does "unsupported" mean? "Abstract" would look more exact. It means they raise io.UnsupportedOperation when called (unless the subclass overrides them to do something else). They are not marked with @abstractmethod, so "Abstract" would be wrong. It should be a bit more clear in context. Here's a link to the point in the documentation where the table would fit: http://docs.python.org/dev/py3k/library/io.html#class-hierarchy The most relevant bit is: "implementations are allowed to raise UnsupportedOperation if they do not support a given operation." > E.g. "readinto" is listed as provided by RawIOBase in the doc text. The doc text describes the API. That is, it describes what the readinto method should do if a subclass of RawIOBase decides to implement it. The existing text doesn't contain any clues as to which methods contain useful implementations versus which will raise io.UnsupportedOperation if not overridden. Hence the need for the table. |
|||
| msg122949 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2010年11月30日 22:40 | |
> > What does "unsupported" mean? "Abstract" would look more exact. > > It means they raise io.UnsupportedOperation when called (unless the > subclass overrides them to do something else). > > They are not marked with @abstractmethod, so "Abstract" would be > wrong. Except that "unsupported" is even more wrong, because it makes it look like that these methods are not supported by the respective ABCs. Actually, what happens is that the default implementations are stubs. If those methods weren't "supported" at all they wouldn't be defined in the first place. |
|||
| msg122951 - (view) | Author: Daniel Stutzbach (stutzbach) (Python committer) | Date: 2010年11月30日 22:44 | |
Other suggestions for a better name for that column are certainly welcome. :-) "Stub Methods"? |
|||
| msg122952 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2010年11月30日 22:45 | |
> Other suggestions for a better name for that column are certainly welcome. :-) > > "Stub Methods"? Fine with me. |
|||
| msg176692 - (view) | Author: Andrew Svetlov (asvetlov) * (Python committer) | Date: 2012年11月30日 16:26 | |
Updated the patch. Is it ok now? |
|||
| msg177034 - (view) | Author: Andrew Svetlov (asvetlov) * (Python committer) | Date: 2012年12月06日 10:24 | |
Fixed in a58204570a7c, 3cb85250a0a3, 93742b046519. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:09 | admin | set | github: 54798 |
| 2012年12月06日 10:24:00 | asvetlov | set | status: open -> closed messages: + msg177034 assignee: stutzbach -> asvetlov resolution: fixed stage: patch review -> resolved |
| 2012年11月30日 16:26:45 | asvetlov | set | files:
+ issue10589.diff nosy: + asvetlov messages: + msg176692 |
| 2012年11月08日 08:29:46 | ezio.melotti | set | stage: needs patch -> patch review versions: + Python 3.3, Python 3.4 |
| 2010年12月01日 17:02:09 | daniel.urban | set | nosy:
+ daniel.urban |
| 2010年11月30日 22:45:11 | pitrou | set | messages: + msg122952 |
| 2010年11月30日 22:44:25 | stutzbach | set | messages: + msg122951 |
| 2010年11月30日 22:40:04 | pitrou | set | messages: + msg122949 |
| 2010年11月30日 22:36:23 | stutzbach | set | messages: + msg122948 |
| 2010年11月30日 22:28:00 | georg.brandl | set | messages: + msg122944 |
| 2010年11月30日 22:26:17 | pitrou | set | messages: + msg122943 |
| 2010年11月30日 22:24:33 | fdrake | set | nosy:
+ fdrake, docs@python |
| 2010年11月30日 22:15:36 | stutzbach | set | files:
+ io-abc.diff nosy: + georg.brandl, benjamin.peterson, ezio.melotti messages: + msg122940 keywords: + patch |
| 2010年11月30日 19:08:02 | pitrou | set | nosy:
+ pitrou |
| 2010年11月30日 19:05:51 | stutzbach | create | |