Another surprise from the datetime module

Roy Smith roy at panix.com
Thu Jan 30 22:58:10 EST 2014


In article <52eb1e37$0$29972$c3e8da3$5496439d at news.astraweb.com>,
 Steven D'Aprano <steve+comp.lang.python at pearwood.info> wrote:

> "replace" is a perfectly reasonable name for a method which performs a 
> replacement, whether it replaces in place (for mutable objects) or makes 
> a copy with replacement (for immutable objects). What else would you call 
> it?

I suppose that by (imperfect) analogy to list.sort() and sorted(list), 
it might make more sense to call it replaced().  But, it's too late for 
any of that now.  The other three classes in the module have replace(), 
so that's the obvious name to use for the fourth class.



More information about the Python-list mailing list