[Numpy-discussion] Syntax equivalent for np.array()

Gael Varoquaux gael.varoquaux at normalesup.org
Wed Feb 10 11:35:32 EST 2010


On Wed, Feb 10, 2010 at 08:33:11AM -0800, Keith Goodman wrote:
> I think this is the rule: When empty it is a tuple; when containing
> one item it is parentheses unless there is a comma.

> >> p = (9)
> >> type(p)
>    <type 'int'>
> >> p = (9,)
> >> type(p)
>    <type 'tuple'>

The coma is the tuple operator. For instance 

p = 9, 

is a tuple.

Gaël



More information about the NumPy-Discussion mailing list