Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #65077

Re: Another surprise from the datetime module

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <cameron@cskk.homeip.net>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.006
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'modify': 0.07; 'modifying': 0.07; 'badly': 0.09; 'subject:module': 0.09; 'way:': 0.09; 'python': 0.11; 'finney': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'hmm.': 0.16; 'message-id:@cskk.homeip.net': 0.16; 'none.': 0.16; 'received:211.29': 0.16; 'received:211.29.132': 0.16; 'received:cskk.homeip.net': 0.16; 'received:homeip.net': 0.16; 'received:optusnet.com.au': 0.16; 'received:syd.optusnet.com.au': 0.16; 'simpson': 0.16; 'stallman': 0.16; 'wrote:': 0.18; 'normally': 0.19; 'header:User-Agent:1': 0.23; 'replace': 0.24; 'header:In-Reply-To:1': 0.27; 'instruction': 0.29; 'object.': 0.31; 'writes:': 0.31; 'subject:the': 0.34; 'subject:from': 0.34; 'agree': 0.35; 'object,': 0.36; 'received:com.au': 0.36; 'method': 0.36; 'ben': 0.38; 'received:211': 0.38; 'richard': 0.38; 'to:addr :python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'read': 0.60; 'new': 0.61; 'content-disposition:inline': 0.62; 'such': 0.63; 'skip:\xe2 10': 0.65; '8bit%:21': 0.69; '8bit%:43': 0.74; '8bit%:46': 0.78; 'refusing': 0.84; 'verb,': 0.84; 'skip:\xe2 30': 0.91
Date Fri, 31 Jan 2014 13:01:40 +1100
From Cameron Simpson <cs@zip.com.au>
To python-list@python.org
Subject Re: Another surprise from the datetime module
MIME-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Disposition inline
Content-Transfer-Encoding 8bit
In-Reply-To <85vbx1aszh.fsf@benfinney.id.au>
User-Agent Mutt/1.5.21 (2010-09-15)
References <85vbx1aszh.fsf@benfinney.id.au>
X-Optus-CM-Score 0
X-Optus-CM-Analysis v=2.1 cv=HZAtEE08 c=1 sm=1 tr=0 a=YuQlxtEQCowy2cfE5kc7TA==:117 a=YuQlxtEQCowy2cfE5kc7TA==:17 a=ZtCCktOnAAAA:8 a=PO7r1zJSAAAA:8 a=LcaDllckn3IA:10 a=fP9v0Dwv92kA:10 a=IkcTkHD0fZMA:10 a=vrnE16BAAAAA:8 a=8AHkEIZyAAAA:8 a=3iwo6vZIqkoA:10 a=u-H5DLiVAH34f5om7jEA:9 a=QEXdDO2ut3YA:10 a=pi0N5G7fiKIA:10
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.6186.1391133711.18130.python-list@python.org> (permalink)
Lines 21
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1391133711 news.xs4all.nl 2863 [2001:888:2000:d::a6]:56910
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:65077

Show key headers only | View raw


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


Thread

Re: Another surprise from the datetime module Cameron Simpson <cs@zip.com.au> - 2014-01-31 13:01 +1100

csiph-web