New Instance Has Old Instance Attribute Values
I want to instantiate multiple instances of books. In my __init__() method I specify some default values. So I am expecting that every time I instantiate a new book, all the old va
Solution 1:
You should not use []
as default argument.
class Book(object):
def __init__(self, title=None, book_rows=None):
self.title = title
self.book_rows = book_rows or []
Post a Comment for "New Instance Has Old Instance Attribute Values"