Re: Make Python create a tuple with one element in a clean way

2008-05-11 Thread MC
Hi! You want 2*(3+4) to return (7,7)? For have that: 2*(3+4,) -- @-salutations Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: Make Python create a tuple with one element in a clean way

2008-05-11 Thread Asun Friere
On May 11, 10:54 pm, [EMAIL PROTECTED] wrote: > To create a tuple with one element, you need to do this: > > >>> my_tuple = (1,)# Note the trailing comma after the value 1 > >>> type(my_tuple) > > > You needn't at all. You could simply do this: >>> your_tuple = 1, You see, it's not the par

Re: Make Python create a tuple with one element in a clean way

2008-05-11 Thread alex23
On May 11, 10:54 pm, [EMAIL PROTECTED] wrote: > I thought that just putting a value inside ( ) > would make a tuple. Apparently that is not the case. It's not the case at all. Check out the Tuples & Sequences section in the python docs at http://docs.python.org/tut/node7: "A tuple consists of a n

Re: Make Python create a tuple with one element in a clean way

2008-05-11 Thread Filip Štědronský
Hello, > so it would be clean if Python would convert anything put into ( ) to > be a tuple, even if just one value was put in (without having to use > that ugly looking comma with no value after it). if it worked that way, it will absolutely mess up Python syntax, because we mathematicians are u

Make Python create a tuple with one element in a clean way

2008-05-11 Thread wxPythoner
To create a tuple with one element, you need to do this: >>> my_tuple = (1,)# Note the trailing comma after the value 1 >>> type(my_tuple) But if you do this >>> my_tuple = (1) >>> type(my_tuple) you don't get a tuple. I thought that just putting a value inside ( ) would make a tuple. Ap