Fredrik Lundh wrote: > > maybe it's just me, but I think it's a bit confusing to have two > functions in the same module with very similar names: > > >>> import locale > > >>> print locale.setlocale.__doc__ > (integer,string=None) -> string. Activates/queries locale processing. > > >>> print locale.set_locale.__doc__ > Set the locale according to the localetuple (language code, > encoding) as returned by get_locale() and get_default(). > > The given codes are passed through the locale aliasing engine > before being given to setlocale() for processing. > > category may be given as one of the LC_* values. It defaults > to LC_ALL. The new set_locale() is meant to complement get_locale(); both work on tuples (langcode, encoding). setlocale() has a completely different interface: it uses a locale category integer together with a setup string. The reasoning here was to add a higher level interface on top of setlocale() which is the direct interface to the underlying low level C API. The underscore variants provide aliasing support and knows about the formats which the setlocale() API will accept -- at least on Linux setlocale() is very picky about case and layout of the setup string. > maybe "setlocale" should be changed to accept either a > string or a tuple? > > (from which follows that get_locale should be "getlocale", and > get_default "getdefaultlocale". or something...) If you want to change anything here: now is the time ;-) Please also adapt site.py which uses these APIs. > (btw, maybe both doc strings should mention the arguments? or > maybe none of them should? what does the style guide say?) I always thought that the arguments should only be mentioned for C functions... not sure, though. -- Marc-Andre Lemburg ______________________________________________________________________ Business: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4