On Aug 2, 2006, at 11:26 PM, Raymond Hettinger wrote:
> Also, -10 on changing the semantics of int() to round instead of
> truncate.  The truncating version is found is so many other languages
> and book examples, that it would be a disaster for us to choose a
> different meaning.

I'd be happy to see floats lose their __int__ method entirely,  
replaced by an explicit truncate function.

I've always thought it quite a hack that python floats have implicit  
truncation to ints, and then a random smattering of APIs go to extra  
lengths to explicitly prevent float.__int__ from being called because  
people thought "passing a float makes no sense!". That's right, it  
doesn't, and it _never_ should happen implicitly, not just in those  
particular few cases. Explicit is better than implicit.

James

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to