Re: Another surprise from the datetime module

Discussion in 'Python' started by Cameron Simpson, Jan 31, 2014.

  1. On 31Jan2014 11:35, Ben Finney <> wrote:
    > Cameron Simpson <> writes:
    > > Hmm. I do not like the replace() as suggested.
    > >
    > > Firstly, replace is a verb, and I would normally read
    > > td.replace(microseconds=0) as an instruction to modify td in place.
    > > Traditionally, such methods in python return None.

    >
    > I agree with this objection. A method that is named “replaceâ€, yet does
    > not modify the object, is badly named.
    >
    > However, the existing ‘replace’ methods ‘datetime.date.replace’,
    > ‘datetime.datetime.replace’, ‘datetime.time.replace’ already work this
    > way: they create a new value and return it, without modifying the
    > original object.


    Ah.
    --
    Cameron Simpson <>

    DRM: the functionality of refusing to function. - Richard Stallman
    Cameron Simpson, Jan 31, 2014
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Christos TZOTZIOY Georgiou
    Replies:
    3
    Views:
    685
    Christos TZOTZIOY Georgiou
    Sep 13, 2003
  2. Tim Peters
    Replies:
    0
    Views:
    517
    Tim Peters
    Sep 9, 2003
  3. Roy Smith
    Replies:
    2
    Views:
    61
    Neil Cerutti
    Jan 30, 2014
  4. Cameron Simpson

    Re: Another surprise from the datetime module

    Cameron Simpson, Jan 31, 2014, in forum: Python
    Replies:
    0
    Views:
    48
    Cameron Simpson
    Jan 31, 2014
  5. Steven D'Aprano

    Re: Another surprise from the datetime module

    Steven D'Aprano, Jan 31, 2014, in forum: Python
    Replies:
    1
    Views:
    60
    Roy Smith
    Jan 31, 2014
Loading...

Share This Page