Let's say we have a simple python model class.
class Library:
def __init__():
self.library_name = None
self.books = []
We would use that by:
new_library = Library()
new_library.library_name = "Delhi International Library"
This would be an empty library with no books. Is this safe? I know you shouldn't use mutable types in the method signature due to when it is evaluated.
new_library.library_name = "Delhi International Library"would be fine, I'm guessing.nameis a typo?self.books = []as part of the init but not as an argument is OK.Librarywill then have its own (initially empty) list of books, rather than sharing a reference to a single central book list.