[Python-Dev] Adding PEP consistent aliases for names that don't currently conform

rdmurray at bitdance.com rdmurray at bitdance.com
Tue Mar 3 14:13:12 CET 2009


On Tue, 3 Mar 2009 at 06:01, Ivan KrstiÄ~G wrote:
> On Mar 2, 2009, at 7:08 PM, Steve Holden wrote:
>> > >  PS.: so is datetime.datetime a builtin then? :)
>> > 
>> >  Another historic accident. Like socket.socket. :-(
>> >
>>  A pity this stuff wasn't addressed for 3.0. Way too late now, though.
>
>
> It may be too late to rename the existing accidents, but why not add 
> consistently-named aliases (socket.Socket, datetime.DateTime, etc) and 
> strongly encourage their use in new code?

As a user I'd be +1 on that.  In fact, I might even start using 'as'
in my own code for that purpose right now.  I've always felt vaguely
confused and disturbed whenever I imported 'datetime', but until this
discussion I didn't realize why :)  Thinking about it, I know I've
written 'from datetime import DateTime' a number of times and then had
to go back and fix my code when I tried to run it.  And I'm sure that
sometimes when that happens I've had to (re)read the docs (or do a 'dir')
to find out why my import wasn't working.

Having said all that out loud, I think I might be stronger than a +1 on
this idea.  I'd be willing to help with doc and even code patches once
I finish learning how to contribute properly.

--RDM


More information about the Python-Dev mailing list