Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'pat': 0.05; 'modify': 0.07; 'badly': 0.09; 'override': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:module': 0.09; 'python': 0.11; 'jan': 0.12; "wouldn't": 0.14; 'finney': 0.16; 'none.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'simpson': 0.16; 'term.': 0.16; 'do,': 0.16; 'wrote:': 0.18; 'normally': 0.19; 'header:User-Agent:1': 0.23; 'replace': 0.24; 'fairly': 0.24; 'header:X-Complaints-To:1': 0.27; 'instruction': 0.29; "d'aprano": 0.31; 'steven': 0.31; 'writes:': 0.31; 'skip:c 30': 0.32; 'fri,': 0.33; 'subject:the': 0.34; "i'd": 0.34; 'subject:from': 0.34; 'agree': 0.35; 'something': 0.35; 'but': 0.35; 'library.': 0.36; 'object,': 0.36; 'received:com.au': 0.36; 'method': 0.36; 'ben': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'though,': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'read': 0.60; 'such': 0.63; 'entitled': 0.65; 'skip:\xe2 10': 0.65; '8bit%:43': 0.74; 'expectations': 0.74; 'received:125': 0.84; 'senator': 0.84; 'verb,': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Ben Finney Subject: Re: Another surprise from the datetime module Date: Fri, 31 Jan 2014 15:40:06 +1100 References: <20140131000631.GA69776@cskk.homeip.net> <52eb1e37$0$29972$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: vmx15867.hosting24.com.au X-Public-Key-ID: 0xBD41714B X-Public-Key-Fingerprint: 9CFE 12B0 791A 4267 887F 520C B7AC 2E51 BD41 714B X-Public-Key-URL: http://www.benfinney.id.au/contact/bfinney-gpg.asc X-Post-From: Ben Finney User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) Cancel-Lock: sha1:ooifgp5GAotSzZF1PRZwcZeEebo= X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1391143222 news.xs4all.nl 2950 [2001:888:2000:d::a6]:36885 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:65087 Steven D'Aprano writes: > On Fri, 31 Jan 2014 11:35:14 +1100, Ben Finney wrote: > > > Cameron Simpson writes: > >> 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. > > […] What else would you call it? I'd call it “substitute”, and keep thinking until I came up with something better. I wouldn't think very hard, though, because the existing usage of ‘foo.replace’ for a create-new-object-with-different-values method is fairly well established in the Python built-in types and standard library. Local expectations do, past some threshold, override general expectations for the meaning of a term. -- \ “Everyone is entitled to their own opinions, but they are not | `\ entitled to their own facts.” —US Senator Pat Moynihan | _o__) | Ben Finney