[Python-3000] Abilities / Interfaces

Fredrik Lundh fredrik at pythonware.com
Thu Nov 23 08:52:04 CET 2006


Phillip J. Eby wrote:

> That kludge, as you call it, is something called idempo...  whoops, I 
> almost used an architecture word there! 

No, that's a mathematical term.  And while Greg wasn't using that word, 
he was actually talking about its CS form, where it means something 
similar, but not entirely equivalent.

In math, something is idempotent if you can change f(x) to f(f(x)) and 
still get the same result; in CS, something is idempotent if you can do 
f(x) twice on the same x, and get the same result both times.

Python's len() function is idempotent in the CS sense, but not in the 
math sense.  And Python's iter() is not necessarily idempotent in the CS 
sense when used on an *iterable*, but it is, in both senses, when used 
on an iterator.  Which was Greg's point, I think.

 > We should never reuse words to describe similar things, because then
 > people would be confused.

Well, I'd say you just illustrated the danger of using the same word to 
described two similar but yet distinctly different concepts.

</F>



More information about the Python-3000 mailing list