Re: Why the expression "(1)" is not an one-arity tuple, but int ?

2009-12-04 Thread MRAB
Andre Engels wrote: 2009/12/4 Петров Александр : Hello All ! In my code I try to use a generic approach to work with tuples. Let "X" be a tuple. When I want to access a first element of a tuple, I can write: "X[0]". And that is really working when X is a n-arity tuple, with n>1 (for example "fo

Re: Why the expression "(1)" is not an one-arity tuple, but int ?

2009-12-04 Thread Baptiste Lepilleur
By adding a before the closing brace of the tucomma after 1. Python allow this to disambiguate between braced expression and tuple >>> type( (1,) ) 2009/12/4 Петров Александр > > How could I tell Python that "(1)" is not an integer, but an one-arity > tuple ? > > Thank you, > Alexander Petrov

Re: Why the expression "(1)" is not an one-arity tuple, but int ?

2009-12-04 Thread Wolodja Wentland
On Fri, Dec 04, 2009 at 15:17 +0300, Петров Александр wrote: > In my code I try to use a generic approach to work with tuples. Let > "X" be a tuple. > When I want to access a first element of a tuple, I can write: "X[0]". > And that is really working when X is a n-arity tuple, with n>1 (for > examp

Re: Why the expression "(1)" is not an one-arity tuple, but int ?

2009-12-04 Thread Baptiste Lepilleur
By adding a before the closing brace of the tuple. Python allow this to disambiguate between braced expression and tuple >>> type( (1,) ) 2009/12/4 Петров Александр > > How could I tell Python that "(1)" is not an integer, but an one-arity > tuple ? > > Thank you, > Alexander Petrov > -- > ht

Re: Why the expression "(1)" is not an one-arity tuple, but int ?

2009-12-04 Thread Andre Engels
2009/12/4 Петров Александр : > Hello All ! > > In my code I try to use a generic approach to work with tuples. Let > "X" be a tuple. > When I want to access a first element of a tuple, I can write: "X[0]". > And that is really working when X is a n-arity tuple, with n>1 (for > example "foo( (1,2,3)

Why the expression "(1)" is not an one-arity tuple, but int ?

2009-12-04 Thread Петров Александр
Hello All ! In my code I try to use a generic approach to work with tuples. Let "X" be a tuple. When I want to access a first element of a tuple, I can write: "X[0]". And that is really working when X is a n-arity tuple, with n>1 (for example "foo( (1,2,3) )" ). But when I call my library function