I'm a -1 on this proposal, as I don't see any way of doing it that wouldn't 
cause a huge amount of disruption. Yes, the situation — especially with regard 
to unittest and logging — is far from ideal. But, it's what we've got.However 
I'm -100 on doing something like this while there already exist a large number 
of camelcase typing-module aliases for classes found elsewhere in the stdlib. 
It's already confusing enough to have `builtins.list` and `typing.List` be 
different objects. Under this proposal, we'd have `builtins.list`, 
`builtins.List`, and `typing.List`. Two of these objects would have the same 
identity, but it wouldn't be the two that are spelt the same. To my mind, this 
would be appalling.Yes, the aliases in the typing module are all deprecated, 
but they're still very widely used.Best, Alex
-------- Original message --------From: Matt del Valle <matthew...@gmail.com> 
Date: 11/11/2021  13:44  (GMT+00:00) To: Python-Ideas <python-ideas@python.org> 
Subject: [Python-ideas] Adding pep8-casing-compliant aliases for the entire 
stdlib So I was reading the docs for the `threading` module and I stumbled upon 
this little note:

Note:
In the Python 2.x series, this module contained camelCase names
for some methods and functions. These are deprecated as of Python 3.10,
but they are still supported for compatibility with Python 2.5 and lower.And it 
got me thinking.Given that there is some precedent, would it be feasible to 
make a concerted effort to add aliases across the board for all public-facing 
stdlib types and functions that don't follow pep8-recommended casing?I realize 
that large chunks of the stdlib predates pep8 and therefore use various 
non-uniform conventions. For example, the logging module is fully camelCased, 
and many core types like `str` and `list` don't use PascalCase as pep8 
recommends. The `collections` module is a veritable mosaic of casing 
conventions, with some types like `deque` and `namedtuple` being fully 
lowercased while others like `Counter` and `ChainMap` are PascalCased.My 
motivation for this twofold:1) I'll confess that this has just always been a 
wart that has bothered me way more than it has any right to. I just hate it. 
Somewhere deep inside my lizard-brain it makes me unhappy to have disparate 
naming conventions in my code. I realize this isn't a good reason in and of 
itself but I wonder if this might not be the case for others as well. While 
I've come to accept it because that's just how it is, maybe it doesn't have to 
be this way?2) It's always been an extra thing to explain when teaching python 
to someone. I always try to cover pep8 very early to discourage people I'm 
training from internalizing bad habits, and it means you have to explain that 
the very standard library itself contains style violations that would get 
flagged in most modern code reviews, and that they just have to keep in mind 
that despite the fact that the core language does it, they should not.So the 
scope of my suggestion is as follows:- lowercase types become PascalCase (e.g., 
`str` -> `Str`, `collections.defaultdict` -> `collections.DefaultDict`)- 
lowercase attributes/functions/methods become snake_case (no changes for names 
that only contain a single word, so `str.lower()` would be unaffected, but 
`str.removeprefix()` would get the alias `str.remove_prefix()`)- pep8 and the 
python docs are updated to state that the pep8-compliant forms of stdlib names 
should be strongly preferred over the legacy names, and that IDEs and linters 
should include (configurable?) weak warnings to discourage the use of 
legacy-cased stdlib names- `help()` would be special-cased for builtin types to 
no longer display any current non-pep8-compliant names, and the python docs 
would also no longer show them, instead only making a note at the top of the 
page as with the `threading` module.Given the horrors of the python 2.7 schism 
I don't think there's any rush to officially deprecate or remove the current 
non-pep8 names at all. I think that's the sort of thing that can happily and 
fully be kicked down the road. If we add aliases and they see widespread 
adoption to the point where the non-pep8 forms are barely ever even seen out in 
the wild then maybe in 10 or 20 years time when the steering council is 
deliberating on a new major python version they can consider rolling the 
removal of legacy badly-cased names into it. And if not then no big deal.So 
yeah, thoughts?



_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/6667GUFX36JTGD433KPPOPWVQV444GNW/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to