Do you know what a closure is? Basically, it’s a function created at runtime that references variables defined in a outer scope. For example: def make_number_printer(n): def number_printer(): print n return number_printer printer = make_number_printer(5) printer() The function make_number_printer receives a number and returns a function which, when called, prints that same number. It’s not [...]
-
About
Brain dumps on programming, cryptography, and computer related stuff.
-
Search
-
Categories