3 ms·
It's not exactly Python (or I'm doing something wrong). Which is very confusing / "dangerous" for people learning Python (They will learn it wrong and not have
by njharman 14y ago
It's not exactly Python (or I'm doing something wrong). Which is very confusing / "dangerous" for people learning Python (They will learn it wrong and not have the xp/confidence to question tutor)
locals() and globals() are undefined.
Still crazy slick (if it were the early 90's I'd say "l33t") bit of coding.
- btown 14y agoIf you're learning Python and are using locals() and globals() as anything more than a debugging tool... I'd venture to say you are doing something wrong ;) In seriousness, any programmer will need to know that functions don't just magically appear... if they don't work, they'll need to know how to pull in some sort of library, or realize why those functions just don't make sense for the current environment (one could explain to a complete novice why it would be a security breach to allow I/O functions, for instance). Python is a language, not a standard library, just as C is C even if you don't #include <stdlib.h>.