empty dictionary as default value for keyword argument in python function: dictionary seems to not be initialised to {} on subsequent calls?

<>

This question already has an answer here:

Answers


>>> def f(i, d=None, x=3):
...     if not d:
...         d={}
...     d[i] = i*i
...     x += i
...     return x,d
... 
>>> f(2)
(5, {2: 4})
>>> f(3)
(6, {3: 9})
>>> 

Need Your Help

Forcing form text to be lower-case

javascript html css

How could I force the text in the "username" text input to be lower-case regardless of what user types?