On Wednesday, July 6, 2011 12:07:56 PM UTC-7, Phlip wrote:
> If I call m = md5() twice, I expect two objects.
> 
> I am now aware that Python bends the definition of "call" based on
> where the line occurs. Principle of least surprise.

Phlip:

We already know about this violation of the least surprise principle; most of 
us acknowledge it as small blip in an otherwise straightforward and clean 
language.  (Incidentally, fixing it would create different surprises, but 
probably much less common ones.)

We've helped you with your problem, but you risk alienating those who helped 
you when you badmouth the whole language on account of this one thing, and you 
might not get such prompt help next time.  So try to be nice.

You are wrong about Python bending the definition of "call", though.  
Surprising though it be, the Python language is very explicit that the default 
arguments are executed only once, when creating the function, *not* when 
calling it.


Carl Banks

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

Reply via email to