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.

Author terry.reedy
Recipients alex, barry, eric.araujo, r.david.murray, terry.reedy
Date 2013-06-21.18:21:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1371838898.94.0.00494242283018.issue18217@psf.upfronthosting.co.za>
In-reply-to
Content
The rationale for install is "For convenience, you want the _() function to be installed in Python’s builtins namespace, so it is easily accessible in all modules of your application." As David noted, this also make it easy to update _ in just one place when a new language is selected.

Alex disagrees and would like to break any code that uses install, which I thing is much code, by removing it. This would force writers to do something else that will be *much* more work and which might make code harder to read. We do not do this without much greater reason than Alex has given. I think this a bad deprecation proposal and should be rejected. I also think the idea should have been posted to python-ideas first.

I do think that this should become a doc issue to clarify the meaning and usage of install.

The link Alex gave was to NullTranslations.install. The module install function itself is at
http://hg.python.org/cpython/file/01da7bf11ca1/Lib/gettext.py#l424

The doc for install could be much improved to say what it actually does.

"Pass *domain*, *localedir*, fallback=True, and *codeset* to translation, which returns translation instance t. Pass *names* to t.install. The default install method, NullTranslations.install <link>, which is inherited by GNUTranslations <link>, installs t.gettext in builtins as _. See the description of translation and NullTranslations.install for the meaning of the parameters."
+ rationale quoted above

This expanded doc would make it clearer that one can write a custom subclass of NullTranslations with a custom .install method that would do something different, such as bind _ to a dynamic (indirect) gettext, whether in builtins or in a project module that is explicitly imported by every module that needs it.

The doc for NullTranslations.install needs the erroneous '()'s removed to make clear that the bindings are to bound methods and not the result of calls to bound methods. Ie, self.gettest() should be just self.gettext.
History
Date User Action Args
2013-06-21 18:21:38terry.reedysetrecipients: + terry.reedy, barry, eric.araujo, alex, r.david.murray
2013-06-21 18:21:38terry.reedysetmessageid: <1371838898.94.0.00494242283018.issue18217@psf.upfronthosting.co.za>
2013-06-21 18:21:38terry.reedylinkissue18217 messages
2013-06-21 18:21:38terry.reedycreate