Identify the root cause behind this function’s behavior. Go!

Estimated read time 1 min read

Post Content

​ Picture this: We have a Flask route handler function that accepts an optional list argument. This list has a mutable default value. Seems simple enough, right? But here’s the catch: When we call this function multiple times using the default argument value, it starts behaving in unexpected ways.

Help us examine how the function behaves and to try to identify the root cause behind this peculiar outcome. Why does the function act differently when called repeatedly?

Subscribe to Google for Developers → https://goo.gle/developers

#Google #Developers   Read More Google for Developers 

You May Also Like

More From Author

+ There are no comments

Add yours