python / cpython

The Python programming language
https://www.python.org
Other
63.49k stars 30.4k forks source link

Termios module documentation is extremely lacking #86568

Open f0e55623-1821-4718-b972-aa6258f2c7ae opened 3 years ago

f0e55623-1821-4718-b972-aa6258f2c7ae commented 3 years ago
BPO 42402
Nosy @iritkatriel

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields: ```python assignee = None closed_at = None created_at = labels = ['3.9', 'docs'] title = 'Termios module documentation is extremely lacking' updated_at = user = 'https://bugs.python.org/danmerillat' ``` bugs.python.org fields: ```python activity = actor = 'iritkatriel' assignee = 'docs@python' closed = False closed_date = None closer = None components = ['Documentation'] creation = creator = 'dan.merillat' dependencies = [] files = [] hgrepos = [] issue_num = 42402 keywords = [] message_count = 3.0 messages = ['381393', '381394', '387337'] nosy_count = 3.0 nosy_names = ['docs@python', 'iritkatriel', 'dan.merillat'] pr_nums = [] priority = 'normal' resolution = None stage = None status = 'open' superseder = None type = None url = 'https://bugs.python.org/issue42402' versions = ['Python 3.9'] ```

f0e55623-1821-4718-b972-aa6258f2c7ae commented 3 years ago

"The interpretation of the flags and the speeds as well as the indexing in the cc array must be done using the symbolic constants defined in the |termios| module." (termios links to itself)

These constants are not listed in the documentation and the termios module is installed as a shared library so you can't read it without going to the source.

Furthermore the example in the documentation uses the following example:

new = termios.tcgetattr(fd)
new[3] = new[3] & ~termios.ECHO          # lflags

Which is explicitly against the documentation on the same page. This has led to most searches on the net turning up people using magic numbers in places instead of symbolic values.

Inserting a list of constants with an extremely brief description would improve the module documentation dramatically.

f0e55623-1821-4718-b972-aa6258f2c7ae commented 3 years ago

Correction, the example source in the documentation is correct as there's no symbolic names for the tty attributes array, only the cc field.

iritkatriel commented 3 years ago

Could it simply be that the link to mod:`termios` should have been to :manpage:`termios(3)` instead?