MySQL set and enum, calling values

Victor Subervi victorsubervi at gmail.com
Fri Dec 11 14:28:23 EST 2009


On Fri, Dec 11, 2009 at 3:12 PM, Carsten Haese <carsten.haese at gmail.com>wrote:

> Victor Subervi wrote:
> > [...] if I go to print, say,
> > colFieldValues[20], which is a set, it prints out the whole set:
> > set('Extra-small','Small','Medium','Large','XLarge','XXLarge','XXXLarge')
> > But if I print out colFieldValues[20][0], it prints out "s".
>
> The only reasonable explanation of this behavior is that despite all
> your wishing for it to be a set, colFieldValues[20] is in fact not a
> set, but rather a string. It is a string containing the letter s,
> followed by the letter e, followed by the letter t, followed by an
> openening parenthesis, and so on.
>
> > Also, how can I test
> > for it? It's an instance of string. How do I know if it's a set?
>
> That's a fantastic question. Python thinks it's a string. What makes you
> think it's a set?
>

Right. I'm doing it the ugly way with the truncating tuple and string
replace.
V
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091211/c9fe9e81/attachment-0001.html>


More information about the Python-list mailing list