3 ms·
I'm not saying that Perl is perfect. Far from it. But saying that Python "will complain about unbound variables instead of silently creating them" is simply in
by duskwuff 3y ago
I'm not saying that Perl is perfect. Far from it.
But saying that Python "will complain about unbound variables instead of silently creating them" is simply incorrect. One of the defining characteristics of Python's variable scope is that assigning to a name always creates it in the current scope; there's no other way to declare a variable. And that's all I'm trying to demonstrate here.
- WesolyKubeczek 3y agoThe act of assigning is creating a variable; the act of using it will complain about an unbound variable. Perl in non-strict mode, PHP last I touched it, Bourne-style shells will just go “yeah, whatever, here’s an empty string”.