New submission from Adam Nemecek <adamneme...@gmail.com>: I'm not sure if this is the intended behavior, but it seems unusual to me. a = [set([]) for i in range(2)] evaluates to a list [set([]),set([])] and b= 2*[set([])] evaluates to [set([]),set([])]. Nothing wrong here. Nevertheless, if I do a[0].add(1), a has the value [set([1]), set([])] but b[0].add(1) evaluates to [set([1]), set([1])]. I understand that in list b, all of the sets refer to the same object in memory, nevertheless, I do not feel like this is the correct behavior.
---------- components: None messages: 117231 nosy: adamnemecek priority: normal severity: normal status: open title: List of sets initialization behavior problems versions: Python 2.7, Python 3.1 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue9932> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com