how to count lines in a file ?

Jonathan Hogg jonathan at onegoodidea.com
Thu Jul 25 04:40:58 EDT 2002


On 25/7/2002 0:18, in article
mailman.1027552836.24420.python-list at python.org, "Delaney, Timothy"
<tdelaney at avaya.com> wrote:

> Another patch is being worked on because putting a file in a cycle would
> kill *lots* of (broken) code written as above. Although the above is not as
> bad as *writing* to a file and not closing it ... but the principal is the
> same.
> 
> The python developers don't want to break code if they can avoid it - I
> personally would be in favour of files not being collected immediately as it
> would remove *any* legitimacy from arguments that "this is OK because it's
> what the implementation does".

I don't want to start an old flamewar, but "broken" depends on your
point-of-view. Before Python had garbage collection, the semantics of object
allocation and deallocation were quite simple and could be relied upon. This
meant that Python was one of the few languages that had useful semantics for
__del__. Reference counting wasn't a particular implementation, it was the
way Python worked.

Such usage only became "broken" when cycle garbage collection was introduced
and people started to rely on the fact that they could create cycles and let
the cycle-gc sort it out later. Unfortunately, "later" is a woolly concept
with cycle-gc.

-bah-this-is-why-I-was-against-cycle-gc-in-the-beginning-ly y'rs,

Jonathan




More information about the Python-list mailing list