Why tuple with one item is no tuple

Steven Bethard steven.bethard at gmail.com
Fri Mar 18 10:49:57 EST 2005


Kay Schluehr wrote:
> On the other hand i find Mathematicas list operators very appealing:
> 
> In =: [1,2,3]^2
> Out=: [1,4,9]
> 
> Compared with this suggar the list comprehension [x**2 for x in
> [1,2,3]]
> is ugly.

py> import numarray
py> a = numarray.array([1, 2, 3])
py> a**2
array([1, 4, 9])

STeVe



More information about the Python-list mailing list