strict python?
Brian Sturk
bsturk at news.rcn.com
Mon Dec 10 22:24:51 EST 2001
On Sun, 9 Dec 2001 21:59:26 +0000 (UTC), Marcin 'Qrczak' Kowalczyk
><qrczak at knm.org.pl> wrote:
> 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).
>
I've been following this thread since I started it and now I understand
why it is legal etc, but I still wish that it could, even if optionally,
be flagged as a warning. I imagine that 8 times out of 10 it was
unintentional. However, I am new to python so maybe this is more
common than I think
I've downloaded PyChecker and hope to try it soon.
--
.-----------------------------------------------------,-------.
| Brian M. Sturk - http://www.nh.ultranet.com/~bsturk \ C/C++ | .> )\,^a__
|--------------------------| bsturk at nh.ultranet.com | Java | ( _ _)/ /-." ~
| http://www.telengard.com `---------------------------`------| `( )_ )/
| Telengard Technologies Inc. - NT/*nix UI & device drivers | _<_s_<_s
'-------------------------------------------------------------'
More information about the Python-list
mailing list