C's syntax (was Re: Python Formatted C Converter (PfCC))
jurgen.defurne at philips.com
jurgen.defurne at philips.com
Thu Oct 26 04:04:47 EDT 2000
aleaxit at yahoo.com@SMTP at python.org on 25/10/2000 19:01:33
Sent by: python-list-admin at python.org
To: python-list at python.org@SMTP
cc:
Subject: Re: C's syntax (was Re: Python Formatted C Converter (PfCC))
Classification:
While this is also a rather sugary issue (excepting those
languages, such as PL/I and Basic, which overload '=' to
mean EITHER assignment OR comparison depending on context;
THAT one is pretty bitter...!-), it interacts with letting
assignment be an expression, _and_ the lack of a specific
'boolean' type exclusively accepted as argument to if/while,
to produce a serious problem. Each of the three choices
is arguably defensible by itself, but all three together
mix badly. Python has chosen to NOT allow assignments as
expressions; I'm not sure that is the "best" solution,
but, it _is_ a solution. In a C context, though, I'd
lean to a different solution -- syntax restriction on what
is accepted in a 'condition' (comparisons, &&, ||, ...,
yes, but not assignments, &, |, ...). Note that this
I agree on not allowing '=' in a condition, but it is nice for
testing bits if one can say
if (var & 0x01) {
}
or
var = (value & 0x01) ? ... : ... ;
Jurgen
More information about the Python-list
mailing list