[Python-ideas] Consistency in naming [was Re: ...ALL CAPS]

Steven D'Aprano steve at pearwood.info
Sun Feb 3 18:19:13 EST 2019

On Sat, Feb 02, 2019 at 11:56:47PM -0500, James Lu wrote:

> > I accept that datetime.datetime reads a bit funny and is a bit annoying. 
> > If we had the keys to the time machine and could go back a decade to 
> > version 3.0, or even further back to 1.5 or whenever the datetime module 
> > was first created, it would be nice to change it so that the class was 
> > DateTime. But changing it *now* is not free, it has real, serious costs 
> > which are probably greater than the benefit gained.

> Why can’t we put “now” as a property of the module itself, reccomend 
> that, and formally deprecate but never actually remove 
> datetime.datetime.now?

The first half of that suggestion has merit. I would definitely 
appreciate a pair of top-level helper functions that returned the 
current date and current datetime. They might even be as simple as this:

# In the datetime module

today = date.today
now = datetime.now

But there is no reason to deprecate the existing functionality. It isn't 
broken or harmful. There's no need to remove it. Being able to construct 
a new date or datetime object using a method of the class is a perfectly 
natural thing to do.

And deprecating a feature that you have no intention of removing just 
adds noise to the language.

> > Actually, no, on average, the projected lifespan of technologies, 
> > companies and cultural memes is about the same as their current age. It 
> > might last less, or it might last more, but the statistical expectation 
> > is about the same as the current age. So on average, "the future" is 
> > about the same as "the past".
> > 
> > Python has been around not quite 30 years now, so we can expect that it 
> > will probably last another 30 years. But chances are not good that it 
> > will be around in 300 years.
> A big reason why projects last as long as you say they last is that 
> the maintainers get un-ambitious, they get used to relaxing in the 
> language they know so well, they are no longer keen on change.

Possibly the most widely-used language in the world, C, is also far more 
conservative and slow-changing than Python. (Python is about in the 
middle as far as speed of change.) We put out new features roughly every 
18 months. C brings them out about once a decade.

Whether we love or hate C, it is pretty clear that it is not going away 
any time soon.


More information about the Python-ideas mailing list