➜

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.

classification
Title: print built-in function docs bug
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.9, Python 3.8, Python 3.7, Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
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 2022-04-11 14:59 by admin. This issue is now closed.

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 (7)
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
msg381020 - (view) Author: Julien Palard (mdk) * (Python committer) Date: 2020-11-15 16:26
Hi!

Thanks Alex for reporting, and everyone involved.

This has been fixed in python-docs-theme, so it's fixed for >=3.8. As 3.7 is in security-only (and embeds python-docs-theme), better not touch it.

Bests.
History
Date User Action Args
2022-04-11 14:59:21adminsetgithub: 82676
2020-11-15 16:26:58mdksetstatus: open -> closed
resolution: fixed
messages: + msg381020

stage: patch review -> resolved
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