Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problematic numbered list in Programming FAQ #128998

Closed
rffontenelle opened this issue Jan 18, 2025 · 1 comment
Closed

Problematic numbered list in Programming FAQ #128998

rffontenelle opened this issue Jan 18, 2025 · 1 comment
Labels
docs Documentation in the Doc dir

Comments

@rffontenelle
Copy link
Contributor

rffontenelle commented Jan 18, 2025

Documentation

Problematic numbered list from Programming FAQ breaking translated Python documentation, showing in English and emits Sphinx warning even without any translation:

faq/programming.rst:1912:<translated>:3: WARNING: Literal block expected; none found. [docutils]

This happens in these lines (permalink for latest commit from 3.13 so far):

1) As recommended by :pep:`8`, an identity test is the preferred way to check
for ``None``. This reads like plain English in code and avoids confusion with
other objects that may have boolean values that evaluate to false.
2) Detecting optional arguments can be tricky when ``None`` is a valid input
value. In those situations, you can create a singleton sentinel object
guaranteed to be distinct from other objects. For example, here is how
to implement a method that behaves like :meth:`dict.pop`::
_sentinel = object()
def pop(self, key, default=_sentinel):
if key in self:
value = self[key]
del self[key]
return value
if default is _sentinel:
raise KeyError(key)
return default
3) Container implementations sometimes need to augment equality tests with
identity tests. This prevents the code from being confused by objects such as
``float('NaN')`` that are not equal to themselves.

Linked PRs

@rffontenelle rffontenelle added the docs Documentation in the Doc dir label Jan 18, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jan 18, 2025
…ythonGH-128999)

(cherry picked from commit e8092e5)

Co-authored-by: Rafael Fontenelle <[email protected]>
Co-authored-by: Adam Turner <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jan 18, 2025
…ythonGH-128999)

(cherry picked from commit e8092e5)

Co-authored-by: Rafael Fontenelle <[email protected]>
Co-authored-by: Adam Turner <[email protected]>
@AA-Turner
Copy link
Member

Backports set to auto-merge.

A

@AA-Turner AA-Turner moved this from Todo to Done in docs issues Jan 18, 2025
AA-Turner added a commit that referenced this issue Jan 18, 2025
…H-128999) (#129000)

gh-128998: Fix indentation of numbered list and literal block (GH-128999)
(cherry picked from commit e8092e5)

Co-authored-by: Rafael Fontenelle <[email protected]>
Co-authored-by: Adam Turner <[email protected]>
AA-Turner added a commit that referenced this issue Jan 18, 2025
…H-128999) (#129001)

gh-128998: Fix indentation of numbered list and literal block (GH-128999)
(cherry picked from commit e8092e5)

Co-authored-by: Rafael Fontenelle <[email protected]>
Co-authored-by: Adam Turner <[email protected]>
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this issue Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir
Projects
Status: Done
Development

No branches or pull requests

2 participants