4 ms·
A safe pattern for this without the None check is keyword expansion which will define defaults when a function is called. def foo(**kwargs): number
by bryanh 13y ago
A safe pattern for this without the None check is keyword expansion which will define defaults when a function is called.
def foo(**kwargs):
numbers = kwargs.pop('numbers', [])
numbers.append(9)
print numbers