classification
Title: print built-in function docs bug
Type: enhancement Stage: patch review
Components: Documentation Versions: Python 3.9, Python 3.8, Python 3.7, Python 3.6, Python 3.5
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Alex Mashianov, docs@python, mdk, methane, serhiy.storchaka, xtreak
Priority: normal Keywords: easy

Created on 2019-10-16 07:36 by Alex Mashianov, last changed 2020-01-22 17:23 by mdk.

Files
File name Uploaded Description Edit
Screenshot_2020-01-22 Fonctions natives — Documentation Python 3 8 1.png mdk, 2020-01-22 17:23
Pull Requests
URL Status Linked Edit
PR 17062 closed python-dev, 2019-11-05 14:23
Messages (6)
msg354778 - (view) Author: Alex Mashianov (Alex Mashianov) Date: 2019-10-16 07:36
Python docs says print() function default sep='': http://joxi.ru/EA44JnfonNwLAb.png

While in reality sep=' ':
http://joxi.ru/n2YXyRsbw6oYm6.png

Probably it's a bug with space not being escaped in html to prevent trimming.
msg354782 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2019-10-16 08:16
In the sphinx source it's ' ' so maybe it's a problem with the rendering part.

https://raw.githubusercontent.com/python/cpython/master/Doc/library/functions.rst

.. function:: print(*objects, sep=' ', end='\\n', file=sys.stdout, flush=False)
msg354783 - (view) Author: Inada Naoki (methane) * (Python committer) Date: 2019-10-16 08:31
Space is not trimmed. You can confirm there is a space by copy&paste it from rendered HTML.

  print(*objects, sep=' ', end='\n', file=sys.stdout, flush=False)¶

So this is caused by rendering <em>sep=' '</em>.
I don't like <em>, but I'm not sure this can be customized by theme.
msg354789 - (view) Author: Inada Naoki (methane) * (Python committer) Date: 2019-10-16 08:57
https://github.com/sphinx-doc/sphinx/pull/6401/files

Recent Sphinx uses <em class="sig-paren">.
So we can add style like this:

  .sig-paren {
    font-family: monospace, sans-serif;
    font-style: normal;
  }
msg354792 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-10-16 09:40
Maybe just explain defaults in the text?

   Print *objects* to the text stream *file* (the standard output by default), separated by *sep* (a space by default) and followed
   by *end* (a newline by default).
msg360489 - (view) Author: Julien Palard (mdk) * (Python committer) Date: 2020-01-22 17:23
PR 17062 about stating it's a space by default has been rejected.

I also feel we should just enhance the space width in the prototype.

I personally see the space, but as it's in italic, I can understand it's very easy to miss it.

I like the `font-family: monospace, sans-serif; font-style: normal;` a lot, it make it clear, see screenshot, but it's an issue for python-docs-theme, opening it there: https://github.com/python/python-docs-theme/issues/42
History
Date User Action Args
2020-01-22 17:23:06mdksetfiles: + Screenshot_2020-01-22 Fonctions natives — Documentation Python 3 8 1.png

nosy: + mdk
messages: + msg360489

keywords: + easy, - patch
2019-11-05 14:23:18python-devsetkeywords: + patch
stage: patch review
pull_requests: + pull_request16570
2019-10-16 09:40:38serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg354792
2019-10-16 08:57:55methanesetmessages: + msg354789
2019-10-16 08:31:27methanesetnosy: + methane
messages: + msg354783
2019-10-16 08:16:16xtreaksetnosy: + xtreak
messages: + msg354782
2019-10-16 07:36:41Alex Mashianovcreate