Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> writes:

> On Fri, 31 Jan 2014 11:35:14 +1100, Ben Finney wrote:
>
> > Cameron Simpson <c...@zip.com.au> 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

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to