[Newbie] Strange output from list

Ben Finney bignose+hates-spam at benfinney.id.au
Tue Nov 11 04:39:28 CET 2008


Andrew <alif016 at gmail.com> writes:

> (47,) is the python representation of a one item tuple

It's also the representation of a one-column result row, which is more
pertinent here.

Just because ‘str(foo) == str(bar)’, does *not* necessarily mean
‘type(foo) == type(bar)’, nor even ‘isinstance(foo, type(bar))’.

It's important to know that result rows are *not* tuples, and that
they have different (and more flexible) semantics.

-- 
 \         “To succeed in the world it is not enough to be stupid, you |
  `\                            must also be well-mannered.” —Voltaire |
_o__)                                                                  |
Ben Finney



More information about the Python-list mailing list