Ð
ðÅÔÒÏ× áÌÅËÓÁÎÄÒ
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 with a 1-arity tuple (for example
"foo( (1) )" ) I have an error:
TypeError: 'int' object is unsubscriptable
How could I tell Python that "(1)" is not an integer, but an one-arity tuple ?
Thank you,
Alexander Petrov
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 with a 1-arity tuple (for example
"foo( (1) )" ) I have an error:
TypeError: 'int' object is unsubscriptable
How could I tell Python that "(1)" is not an integer, but an one-arity tuple ?
Thank you,
Alexander Petrov