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.

Title: StreamReaderProtocol inheritance
Type: enhancement Stage: resolved
Components: asyncio Versions: Python 3.10, Python 3.9, Python 3.8, Python 3.7
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: asvetlov, danpascu, yselivanov
Priority: normal Keywords:

Created on 2020-08-16 06:57 by danpascu, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (4)
msg375504 - (view) Author: Dan Pascu (danpascu) Date: 2020-08-16 06:57
I noticed that StreamReaderProtocol is defined like this:

class StreamReaderProtocol(FlowControlMixin, protocols.Protocol):

but FlowControlMixin already inherits protocols.Protocol:

class FlowControlMixin(protocols.Protocol):

It seems redundant that StreamReaderProtocol has protocols.Protocol as a second base class (is this an oversight or I'm missing some hidden reasoning behind it in which case it might be useful to have it mentioned in a comment to avoid confusion).
msg381889 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2020-11-26 09:03
You are right, but the existing inheritance is also correct (while a little redundant).

Sorry, I don't think we should do anything: don't fix if not broken.
msg381993 - (view) Author: Dan Pascu (danpascu) Date: 2020-11-28 11:25
While it may not be affected at a functional level (at least not in a way I can see right now), it is confusing when reading that code.

Isn't clarity and avoiding confusion a desired trait for core python code?

What about all these recommendations from the Zen of Python?

Beautiful is better than ugly.
Simple is better than complex.
Flat is better than nested.
Readability counts.
If the implementation is hard to explain, it's a bad idea.
msg382010 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2020-11-28 15:21
Fixing a non-broken thing is not a world-class idea, I think.
Date User Action Args
2022-04-11 14:59:34adminsetgithub: 85734
2020-11-28 15:21:38asvetlovsetmessages: + msg382010
2020-11-28 11:25:14danpascusetmessages: + msg381993
2020-11-26 09:03:22asvetlovsetstatus: open -> closed
resolution: not a bug
messages: + msg381889

stage: resolved
2020-08-16 06:57:08danpascucreate