[Python-ideas] Rename time module to "posixtime"

Bruce Leban bruce at leapyear.org
Thu Jun 17 07:01:16 CEST 2010


OK, let me revise that. There were lots of different things discussed on
this thread. I agree that

    import time
confounds with
    from datetime import time

and it would be nice to fix that. An alias would be reasonable. Change the
documentation to refer to the new name and leave the old name for legacy
apps. I know TOOWTDI but if the time module has two names until python 4 is
that a major problem?

I'm not in favor of moving things around among the modules etc.

When you say "And where in the docs would you explain the following: :-)"
that sounds like you're saying "this is too confusing we shouldn't document
it." To which I can only say :-(

--- Bruce


On Wed, Jun 16, 2010 at 8:25 AM, Alexander Belopolsky <
alexander.belopolsky at gmail.com> wrote:

> On Wed, Jun 16, 2010 at 10:48 AM, Bruce Leban <bruce at leapyear.org> wrote:
> > -1 to moving anything
> >
>
> I am getting a feeling that you are attacking a strawman.  Deprecating
> time module in favor of posixtime is only the third part of my
> proposal and I don't insist on any particular depreciation schedule.
> All I want is to give users one obvious way to avoid conflict between
> time and datetime.time.  Note that since datetime only defines a
> handful of module level symbols, it is quite common to see from
> datetime import date, datetime, time and it is quite confusing when
> this conflicts with import time.
>
> > The situation is confusing and moving things will add to that confusion
> for
> > a significant length of time.
> >
> Let's be constructive.  What specifically do you find confusing?  Do
> you agree with the list of confusing things that I listed in my
> previous posts?
>
> > What I would instead suggest is improving the docs. If I could look in
> one
> > place to find any time function it would mitigate the fact that they're
> > implemented in multiple places.
>
> I think having datetime.datetime.strftime and time.strftime documented
> in one place will not help anyone.  And I am not even mentioning
> datetime.time.strftime which is of course not the same as
> time.strftime and that for {date,datetime,time}.strftime function you
> need to specify date/time object first and format last but for time
> module strftime it is the other way around. Etc. etc.
>
> I think most users will be happier not knowing about time module
> strftime function.  Even better not knowing about strftime at all and
> using "..".format(dt) instead.
>
> And where in the docs would you explain the following: :-)
>
> >>> from datetime import datetime
> >>> import time
> >>> time.strftime("%c %z %Z", datetime.utcnow().utctimetuple())
> 'Wed Jun 16 15:22:15 2010 -0500 EST'
>
> (Note utc in datetime calls and EST in time.strftime output.)
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20100616/0f1e29d1/attachment.html>


More information about the Python-ideas mailing list