dn wrote:
>Loris Bennett wrote:
>> However, with a view to asking forgiveness rather than
>> permission, is there some simple way just to assign the dictionary
>> elements which do in fact exist to self-variables?
>
>Assuming config is a dict:
>
> self.__dict__.update( config )
Here's
Anders Munch added the comment:
Are you sure you want to do this?
This optimisation is not applicable if the matched values are given symbolic
names. You would be encouraging people to write bad code with lots of
literals, for speed.
--
nosy: +AndersMunch
Anders Munch added the comment:
>> What does use getlocale is time.strptime and datetime.datetime.strptime, so
>> when getlocale fails, strptime fails.
> Would they work with getlocale() returning None for the encoding ?
Yes. All getlocale is used for in _strptime.py is comp
Anders Munch added the comment:
> BTW: What is wxWidgets doing with the returned values ?
wxWidgets doesn't call getlocale, it's a C++ library (wrapped by wxPython) that
uses C setlocale.
What does use getlocale is time.strptime and datetime.datetime.strptime, so
when getlocale fa
Anders Munch added the comment:
getlocale is documented to return None for the encoding if no encoding can be
determined. There's no need to guess.
I can't change the locale.setlocale call, because where I'm actually having the
problem, I'm not even calling locale.setlocale: wxWidgets
Anders Munch added the comment:
I discovered that this can happen with underscores as well:
Python 3.8.7 (tags/v3.8.7:6503f05, Dec 21 2020, 17:59:51) [MSC v.1928 64 bit
(AMD64)] on win32
Type "help", "copyright", "credits" or "license"
New submission from Anders Munch :
getlocale fails with an exception when the string returned by _setlocale is
already an RFC 1766 language tag.
Example:
Python 3.10.0a4 (tags/v3.10.0a4:445f7f5, Jan 4 2021, 19:55:53) [MSC v.1928 64
bit (AMD64)] on win32
Type "help", "copyr
Steven D'Aprano:
It is not a guess if the user explicitly specifies that as the behaviour.
If that was the context, sure, no problem.
- Anders
--
https://mail.python.org/mailman/listinfo/python-list
Richard Damon wrote:
The two behaviors that I have heard suggested are:
1) If any of the inputs are a NaN, the median should be a NaN.
(Propagating the NaN as indicator of a numeric error)
2) Remove the NaNs from the input set and process what is left. If
nothing, then return a NaN (treating