New submission from Chester <[EMAIL PROTECTED]>: 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) <type 'tuple'> But if you do this >>> my_tuple = (1) >>> type(my_tuple) <type 'int'> you don't get a tuple. I thought that just putting a value inside ( ) would make a tuple. Apparently that is not the case. I hate ugly code 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). ---------- messages: 66626 nosy: chester severity: normal status: open title: Make Python create a tuple with one element in a clean way type: feature request versions: 3rd party, Python 2.1.1, Python 2.1.2, Python 2.2, Python 2.2.1, Python 2.2.2, Python 2.2.3, Python 2.3, Python 2.4, Python 2.5, Python 2.6, Python 3.0 __________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2817> __________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com