Re: mixing set and list operations

2015-04-30 Thread Tim
On Thursday, April 30, 2015 at 1:05:05 PM UTC-4, Ben Finney wrote: Tim writes: You can use 'extend' to add set elements to a list and use 'update' to add list elements to a set. And you can use both of those methods to add items from a file:: foo = ['one', 'two'] bar =

Re: mixing set and list operations

2015-04-30 Thread Carl Meyer
Hi Tim, On 04/30/2015 10:07 AM, Tim wrote: 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'])

Re: mixing set and list operations

2015-04-30 Thread Ben Finney
Tim jtim.arn...@gmail.com writes: You can use 'extend' to add set elements to a list and use 'update' to add list elements to a set. And you can use both of those methods to add items from a file:: foo = ['one', 'two'] bar = open('/usr/share/common-licenses/GPL-3')

mixing set and list operations

2015-04-30 Thread Tim
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 =

Re: mixing set and list operations

2015-04-30 Thread Ian Kelly
On Thu, Apr 30, 2015 at 10:07 AM, Tim jtim.arn...@gmail.com wrote: 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. It's not implementation