So C has closures now?
#include <stdio.h>
int x = 1;
int f(int y) {
return x + y;
}
int
main(argv, argc) {
printf("f(2): %i\n", f(2));
}
The reason they are called closures is because they close over the, lexical, environment where the function was defined.Python doesn't have lexical scope, hence it doesn't have closures.