how to count lines in a file ?

Bo M. Maryniuck b.maryniuk at forbis.lt
Thu Jul 25 08:51:09 EDT 2002


On Thursday 25 July 2002 13:27, Jonathan Hogg wrote:
> As noted earlier in the thread, files don't take part in gc. This is
> because they don't (at least for the moment) hold references to other
> objects. Generally only container objects (lists, dictionaries, tuples,
> instances, classes, etc.) take part in gc and show up in the gc statistics.

Therefore code:
----------8<------------
>>> a = open('file')
>>> a.close()
>>> del a
----------8<------------

...and just...
----------8<------------
>>> open('file')
<open file 'file', mode 'r' at 0x81926f8>
----------8<------------

..."make" different garbage in the memory and second one provides more "crap"?

-- 
Sincerely yours, Bogdan M. Maryniuck

linux: the choice of a GNU generation
(ksh at cis.ufl.edu put this on Tshirts in '93)





More information about the Python-list mailing list