Apr-08-2020, 01:59 PM
This isn't a matter of global versus local. Rather, it's a matter of Python's sequence implementation. Sequences, such as a list, store values by reference to a memory location. As a result, a list is basically a pointer used in other languages. This enables changes to a list made within a function to change the list outside the function.