2 ms·
FTR, Python does not in fact do this. Python 2 did have this locale-dependent behavior, but Python 3 has never behaved this way. The workaround in the OP is, th
by price 6y ago
FTR, Python does not in fact do this. Python 2 did have this locale-dependent behavior, but Python 3 has never behaved this way. The workaround in the OP is, thankfully, quite obsolete.
If you call a case-related method like `lower` on a Python string, the behavior you get is based on tables which are built into Python, taken straight from the Unicode standard's data files, and completely independent of your system configuration.
It would nice to also have the option of explicitly using a particular locale. Here's a discussion from 2019 about potentially adding that option:
https://bugs.python.org/issue37848 https://bugs.python.org/issue37848
You'll be glad to see everyone there agrees the default should remain invariant.