Strange thing: file.close did not show error but work wrong

Steve Holden sholden at holdenweb.com
Mon Nov 26 08:56:00 EST 2001


"Kragen Sitaker" <kragen at canonical.org> wrote ...
> "Emile van Sebille" <emile at fenx.com> writes:
>
> > "wqhdebian" <wqhdebian at 263.net> wrote in message
> > news:db288b61.0111211822.2e903177 at posting.google.com...
> > > fdw.close#########################  When I use like this ,there is no
> > > warning and
> > > ##############any error message,but the file do not have been
> > > writen.After I change back to fdw.close(),Then it work well.
> >
> > Yes, this is all as it should be.
>
> It's semantically consistent with the rest of Python, but it's
> suboptimal from a human-factors perspective, IMHO; people who are used
> to Perl or Delphi or Pascal will expect it to call fdw.close.  It
> would be nice if the interpreter were smart enough to issue a warning
> in this case: a method is gotten and then immediately discarded.
>
>
Unfortunately this would require special-casing the
"expression-as-statement" construct. This would probably gobble up far more
time than could be justified. How would you then have the statements treated
in interactive interpreter sessions, where normally the method would be
identified as the result of the expression?

regards
 Steve
--
http://www.holdenweb.com/








More information about the Python-list mailing list