I noticed this today, using Python2.7 or 3.4, and wondered if it is 
implementation dependent:

You can use 'extend' to add set elements to a list and use 'update' to add list 
elements to a set.

>>> m = ['one', 'two']
>>> p = set(['three', 'four'])
>>> m.extend(p)
>>> m
['one', 'two', 'four', 'three']

>>> m = ['one', 'two']
>>> p = set(['three', 'four'])
>>> p.update(m)
>>> p
set(['four', 'three', 'two', 'one'])


Useful if you don't care about ordering. Not sure if it's dangerous.

thanks,
--Tim

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to