Python's "only one way to do it" philosophy isn't good?
exarkun at divmod.com
Fri Jun 29 16:30:40 CEST 2007
On Fri, 29 Jun 2007 09:56:14 -0400, Douglas Alan <doug at alum.mit.edu> wrote:
>"Chris Mellon" <arkanes at gmail.com> writes:
>> You're arguing against explicit resource management with the argument
>> that you don't need to manage resources. Can you not see how
>> ridiculously circular this is?
>No. It is insane to leave files unclosed in Java (unless you know for
>sure that your program is not going to be opening many files) because
>you don't even know that the garbage collector will ever even run, and
>you could easily run out of file descriptors, and hog system
>On the other hand, in Python, you can be 100% sure that your files
>will be closed in a timely manner without explicitly closing them, as
>long as you are safe in making certain assumptions about how your code
>will be used. Such assumptions are called "preconditions", which are
>an understood notion in software engineering and by me when I write
You realize that Python has exceptions, right? Have you ever encountered
a traceback object? Is one of your preconditions that no one will ever
handle an exception raised by your code or by their own code when it is
invoked by yours?
More information about the Python-list