f---ing typechecking

James Stroud jstroud at mbi.ucla.edu
Wed Feb 14 22:45:14 EST 2007


Steven D'Aprano wrote:
> On Wed, 14 Feb 2007 13:25:21 -0800, James Stroud wrote:
> 
> 
>>But then again, the unimaginative defense would be that it wouldn't be 
>>python if you could catentate a list and a tuple.
> 
> 
> Since lists and tuples are completely different objects with completely
> different usages, what should concatenating a list and a tuple give?
> Should it depend on the order you pass them?

Is that a guess or just common sense?

> 1.0 + 1 == 1 + 1.0 for very good reasons: we consider (for pragmatic
> reasons to do with loss of significant digits) that floats coerce ints
> into floats rather than the other way around. But what should lists and
> tuples do?
> 
> From the Zen of Python:
> "In the face of ambiguity, refuse the temptation to guess."

Do you guess with __add__ and __radd__?

James



More information about the Python-list mailing list