strict python?
Marcin 'Qrczak' Kowalczyk
qrczak at knm.org.pl
Sun Dec 9 16:59:26 EST 2001
Fri, 07 Dec 2001 06:34:20 GMT, Hans Nowak <wurmy at earthlink.net> pisze:
> Well, 'self.func' is a perfectly valid Python expression,
> just like '3'. Not very useful when used like this, but
> still, perfectly valid.
It would be easy to define Python's syntax differently, such that
only some forms of expressions are valid as statements. Of course it
would break compatibility.
A small problem is that you can't know whether x.func has side effects:
it can throw an exception if the attribute doesn't exist, and it can
call a side-effecting __getattr__. But I believe that disallowing this
would not be a problem if the language was designed today (you can
always work around this by assigning the result to a dummy variable).
--
__("< Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
\__/
^^
QRCZAK
More information about the Python-list
mailing list