Python handles globals badly.
steve at pearwood.info
Thu Sep 10 17:59:27 CEST 2015
On Thu, 10 Sep 2015 04:59 am, random832 at fastmail.us wrote:
> On Wed, Sep 9, 2015, at 13:55, Steven D'Aprano wrote:
>> In fairness to the C creators, I'm sure that nobody back in the early
>> seventies imagined that malware and security vulnerabilities would be as
>> widespread as they have become. But still, the fundamental decisions made
>> by C are lousy. Assignment is an expression?
> Whoa, hold on. The problem with C assignment isn't that it's an
> expression, it's that it's spelled "=" and can be used in contexts where
> one would normally do an equality comparison.
Yes, that's what I'm referring to.
Although, I'm not sure that I agree with the idea that "everything is an
expression". I think that's a category mistake, like asking for the speed
of dark, or for a bucket of cold. Some things are functional by nature,
and other things are imperative; some may be both, but I don't think that
assignment is one. I think that assignment is imperative, not functional,
and forcing it to return a value is artificial.
> In some languages (Lisp/Scheme/etc come to mind), *everything* is an
> expression. But assignment is spelled with, generally, some variant of
> "set" [setq, set!, etc].
Yes, that at least avoids the possibility of mistaking = for == or similar.
 Obviously it's faster than light, since wherever the light arrives, it
finds the dark got there first.
More information about the Python-list