Why tuple with one item is no tuple

Antoon Pardon apardon at forel.vub.ac.be
Wed Mar 30 01:58:04 EST 2005


Op 2005-03-29, Ville Vainio schreef <ville at spammers.com>:
>>>>>> "Antoon" == Antoon Pardon <apardon at forel.vub.ac.be> writes:
>
>    Antoon> Op 2005-03-27, Joal Heagney schreef <joal at bigpond.net.au>:
>     >> Antoon Pardon wrote:
>     >> <snip>
>     >>> So python choose a non-deterministic direction. To me (2,3) + (4,5)
>     >>> equals (6,8). I don't dispute that having an operator to combine
>     >>> (2,3) and (4,5) in (2,3,4,5) is usefull, but they should never have
>     >>> used the "+" for that.
>     >> 
>     >> ("alph", "bravo") + ("delta", "max") --> ("alphdelta", "bravomax")
>
>    Antoon> No, that wouldn't be the result. You are still using "+"
>    Antoon> for concatenation, even if only on strings. I say python
>    Antoon> should have used something else for concatenation (string
>    Antoon> concatenation included)
>
> To me, nothing is more natural than "ab" + "cd" == "abcd". Also [1,2]
> + [3,4] == [1,2,3,4]. "Dot product" is not really too useful in real
> world (non-mathematical) apps.

What is more natural, that you concatenate strings and lists or that
you use the "+" for it. Suppose python would have used '#" to express
concatenation so that "ab" # "cd" == "abcd". After using this for
sometime nothing would have been more natural than this.

-- 
Antoon Pardon



More information about the Python-list mailing list