version 1
def add_author(authors_books, current_books=None):
if current_books is None:
current_books = []
current_books.extend(authors_books)
return current_books
version 2
def add_author(authors_books):
current_books = []
current_books.extend(authors_books)
return current_books
In version 1 why would you use "current_books = None" and the following "if" statement if you could get the same outcome using the function in version 2?
Is there certain use cases where you would put a parameter as = to None?