[issue44420] Add CapWords classes to datetime module?

Douglas Thor report at bugs.python.org
Mon Jun 14 14:00:51 EDT 2021


New submission from Douglas Thor <doug.thor at gmail.com>:

Has there been any discussion on adding CapWords class names to the datetime.py module?

I searched through the bug tracker ("CapWords" and "CamelCase") and didn't find anything, but perhaps I'm not searching for the correct keywords.

Eg:

```
# datetime.py
class datetime:
    ...

class tzinfo:
    ...

...

DateTime = datetime
TzInfo = tzinfo
TimeZone = timezone
TimeDelta = timedelta
...
```


I'd imaging implementing this would be pretty trivial and wouldn't break any existing functionality. I'd be happy to implement it.


Benefits:
+ Starts down the road to naming conventions found in pep8.
+ Maybe makes discovery easier for new users? It can be confusing for new users when the same word "datetime" can refer to either a class or a module.
+ Can start a deprecation process for the all-lowercase class names if so desired (actually doing so is outside the scope of this discussion)
+ Makes it easy, at a glance, to tell if code is referring to `datetime` the module or `DateTime` the class.


Downsides:
- fragments future usage: there will be a split between people using `DateTime` and `datetime`. This makes it hard to do things like mass grep over codebase.
- "If it ain't broke, don't fix it"
- ???

----------
components: Library (Lib)
messages: 395830
nosy: dougthor42
priority: normal
severity: normal
status: open
title: Add CapWords classes to datetime module?
type: enhancement
versions: Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44420>
_______________________________________


More information about the Python-bugs-list mailing list