will it cause any problems to open a read-only file & not close it?

Fuzzyman fuzzyman at gmail.com
Mon Mar 14 07:30:11 EST 2005


Sara Khalatbari wrote:
> Dear friends
> In a code, I'm opening a file to read. Like :
>     lines = open(filename).readlines()
> & I'm never closing it.
> I'm not writing in that file, I just read it.
>
> Will it cause any problems if you open a file to read
> & never close it?
>
>

Under CPython the filehandle will be automatically garbage collected.
Under JPython (Jython) it won't be... It's a very useful shortcut
though *sigh*

Regards,

Fuzzy
http://www.voidspace.org.uk/python/index.shtml

>
>
> __________________________________
> Do you Yahoo!?
> Make Yahoo! your home page 
> http://www.yahoo.com/r/hs




More information about the Python-list mailing list