Hello All,

Why is python designed so that b and c (according to code below)
actually share the same list object? It seems more natural to me that
each object would be created with a new list object in the points
variable.

class Blob:
    def __init__(self, points=[]):
        self._points = points


b = Blob()
c = Blob()

b._points.append(1)
c._points.append(2)

print b._points

# this will show that b._points is the same object as c._points









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

Reply via email to