Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #65077
| Date | 2014-01-31 13:01 +1100 |
|---|---|
| From | Cameron Simpson <cs@zip.com.au> |
| Subject | Re: Another surprise from the datetime module |
| References | <85vbx1aszh.fsf@benfinney.id.au> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.6186.1391133711.18130.python-list@python.org> (permalink) |
On 31Jan2014 11:35, Ben Finney <ben+python@benfinney.id.au> wrote: > Cameron Simpson <cs@zip.com.au> 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 <cs@zip.com.au> DRM: the functionality of refusing to function. - Richard Stallman
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Another surprise from the datetime module Cameron Simpson <cs@zip.com.au> - 2014-01-31 13:01 +1100
csiph-web