Skip to content

Commit 8587cf6

Browse files
committed
per feedback from @ejucovy, warn about shadowing gettext with "_"
1 parent 3268aff commit 8587cf6

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

docs/conf.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
# Add any Sphinx extension module names here, as strings. They can be extensions
2727
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
28-
extensions = ['sphinx.ext.ifconfig', 'sphinx.ext.todo']
28+
extensions = ['sphinx.ext.ifconfig', 'sphinx.ext.todo', 'sphinx.ext.intersphinx']
2929

3030
# Add any paths that contain templates here, relative to this directory.
3131
templates_path = ['_templates']
@@ -260,3 +260,7 @@
260260
#epub_tocdup = True
261261

262262
todo_include_todos = True
263+
264+
intersphinx_mapping = {
265+
'python': ('http://docs.python.org/', None),
266+
}

docs/writing/style.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ will not need that variable, use ``_``:
3737
filename = 'foobar.txt'
3838
basename, _, ext = filename.rpartition()
3939
40+
.. note::
41+
42+
"``_``" is commonly used as an alias for the :func:`~gettext.gettext`
43+
function. If your application uses (or may someday use) :mod:`gettext`,
44+
you may want to avoid using ``_`` for ignored variables, as you may
45+
accidentally shadow :func:`~gettext.gettext`.
46+
4047
Create a length-N list of the same thing
4148
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4249

0 commit comments

Comments
 (0)