Ticket #5951 defect new

Opened 8 months ago

Last modified 6 weeks ago

Documentation for the best way to get a reference to a reactor reads as contradictory

Reported by: cyli Owned by: wirehead
Priority: normal Milestone:
Component: core Keywords: documentation
Cc: Branch: branches/clarify_reactor_doscstring-5951-2
Author: tomprince Launchpad Bug:

Description

 http://twistedmatrix.com/documents/12.2.0/api/twisted.internet.reactor.html

"Regardless of which reactor is installed, importing this module is the correct way to get a reference to it."

"New application code should prefer to pass and accept the reactor as a parameter where it is needed, rather than relying on being able to import this module to get a reference."

These seem to be contradictory statements. When/where it should be imported rather than passed should be clarified.

Attachments

ticket-5951-docs.patch Download (2.6 KB) - added by wirehead 2 months ago.
ticket-5951-2-docs.patch Download (2.6 KB) - added by wirehead 2 months ago.
v2 patch

Change History

1

Changed 8 months ago by teratorn

I guess it means there should be ONE place where you import the reactor (like a twistd plugin file), and then pass it on everywhere else.

2

Changed 8 months ago by cyli

(In [35780]) add examples to the docstring for clarity refs #5951

3

Changed 8 months ago by cyli

(In [35781]) less passive voice in reactor docstring refs #5951

4

Changed 8 months ago by cyli

  • owner cyli deleted
  • keywords documentation, easy, review added; documentation removed
  • branch set to clarify_reactor_doscstring_5951

5

Changed 8 months ago by jerub

  • keywords easy added; easy, review removed

Please add a news file before merging.

Approved :)

6

Changed 8 months ago by jerub

  • owner set to cyli

7

8

Changed 8 months ago by cyli

  • status changed from new to closed
  • resolution set to fixed

(In [35841]) Merge clarify_reactor_doscstring_5951: Elaborate on how to import reactors

Author: cyli Reviewer: jerub Fixes: #5951

Clarify the reactor docstring on how to pass reactors around

9

Changed 8 months ago by exarkun

  • keywords documentation added; documentation, removed

Some problems here:

  1. do_something_later and do_something do not follow the naming convention.
  2. def do_something_later(*args, reactor=None, **kwargs): is not valid Python syntax.
  3. import reactor will typically not import the reactor.
  4. do_something_later isn't the way to mark up code in a docstring - C{do_something_later} is.

These are minor, but since there are so many of them it would probably be nice to revert this merge (or else fix them in another ticket today).

10

Changed 8 months ago by exarkun

  • status changed from closed to reopened
  • resolution fixed deleted

(In [35872]) Revert r35841 - the example is broken and diverges from the coding standard

Reopens: #5951

11

Changed 2 months ago by wirehead

  • status changed from reopened to new
  • owner cyli deleted

12

Changed 2 months ago by wirehead

  • status changed from new to assigned
  • owner set to wirehead

Changed 2 months ago by wirehead

13

Changed 2 months ago by wirehead

  • keywords review added
  • status changed from assigned to new
  • branch clarify_reactor_doscstring_5951 deleted
  • owner wirehead deleted

This should fix the issues addressed with the reverted change.

14

Changed 2 months ago by wirehead

Discussion in person: Default of None needs to go away.

Changed 2 months ago by wirehead

v2 patch

15

Changed 7 weeks ago by tomprince

  • branch set to branches/clarify_reactor_doscstring-5951-2
  • branch_author set to tomprince

(In [37903]) Branching to clarify_reactor_doscstring-5951-2.

16

Changed 7 weeks ago by tomprince

(In [37906]) Apply ticket-5951-2-docs.patch from wirehead.

Refs: #5951

17

Changed 7 weeks ago by tom.prince

  • keywords review removed
  • owner set to wirehead
  1. The paragraph about default reactors should be split into multiple sentences.
  2. I'm not sure saying anything about multiple reactors makes sense.
  3. "Then the - C{doSomethingLater}": the "-" seems superfluous.
  4. "Also, imported the reactor": importing.
  5. When discussing reactor-already-imported, mentioning twistd *plugins* might be helpful. I was going to suggest that twistd already ensures that (which is true when using --python).
  6. It would be good to reference twisted.internet.task.react.

18

Changed 6 weeks ago by itamar

  • keywords easy removed
Note: See TracTickets for help on using tickets.