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: selectors: improve examples section
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.4
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, gvanrossum, neologix, pitrou
Priority: normal Keywords: needs review, patch

Created on 2013-11-29 19:52 by neologix, last changed 2022-04-11 14:57 by admin. This issue is now closed.

File name Uploaded Description Edit
selectors_examples.diff neologix, 2013-11-29 20:39 review gvanrossum, 2013-11-29 21:18
selectors_example-1.diff neologix, 2013-11-29 22:46 review
Messages (7)
msg204750 - (view) Author: Charles-François Natali (neologix) * (Python committer) Date: 2013-11-29 19:52
Here's a patch improving the "examples" section for the selectors module.
msg204751 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-11-29 20:42
This sounds ok to me.
msg204752 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2013-11-29 21:01
This is definitely an improvement over the previous example, but I think both examples are still pretty unrealistic; they seem to be more useful as smoke tests than as examples.  My primary concern is that, in order to be both self-contained and small, both examples have both the sender and the receiver in the same code (connected by a socketpair).  But this makes them useless as starting points for simple applications built around a typical select loop.

Perhaps a basic echo service would be a better starting point?  I'll try to create one.
msg204753 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2013-11-29 21:15
Here's my suggestion.  It can use a lot of cleaning up, but it shows the fundamentals of a selector-based I/O loop.
msg204755 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2013-11-29 21:18
Sorry, here's a version with slightly more logical order of the code.
msg204760 - (view) Author: Charles-François Natali (neologix) * (Python committer) Date: 2013-11-29 22:46
Here's an updated patch adding your echo server to the examples section.
msg204761 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2013-11-29 22:54
Committed: revision 2a679870d7d2.
Date User Action Args
2022-04-11 14:57:54adminsetgithub: 64035
2013-11-29 22:54:00gvanrossumsetstatus: open -> closed
resolution: fixed
messages: + msg204761

stage: patch review -> resolved
2013-11-29 22:46:27neologixsetfiles: + selectors_example-1.diff

messages: + msg204760
2013-11-29 21:18:42gvanrossumsetfiles: -
2013-11-29 21:18:30gvanrossumsetfiles: +

messages: + msg204755
2013-11-29 21:15:13gvanrossumsetfiles: +

messages: + msg204753
2013-11-29 21:01:03gvanrossumsetmessages: + msg204752
2013-11-29 20:42:52pitrousetnosy: + gvanrossum, pitrou
messages: + msg204751
2013-11-29 20:39:18neologixsetfiles: + selectors_examples.diff
2013-11-29 20:39:03neologixsetfiles: - selectors_examples.diff
2013-11-29 19:52:15neologixcreate