Convert set to list

Chris Angelico rosuav at gmail.com
Thu Mar 31 20:00:36 EDT 2016


On Fri, Apr 1, 2016 at 10:56 AM, Larry Martell <larry.martell at gmail.com> wrote:
> I feel like I've converted sets to lists before. But maybe not. Or
> maybe I am losing it from having worked 70 hours this week.
>
> Shouldn't this work?
>
> (Pdb) print block['relative_chart1']['vessel_names']
> set([u'Common Carotid', u'External Carotid', u'Internal Carotid'])
> (Pdb) type(block['relative_chart1']['vessel_names'])
> <type 'set'>
> (Pdb) list(block['relative_chart1']['vessel_names'])
> *** Error in argument: "(block['relative_chart1']['vessel_names'])"

What exactly does "Error in argument" mean? Normally I would agree,
yes, you should be able to iterate over a set exactly like that.

ChrisA



More information about the Python-list mailing list