Writing to a certain line?
Jack Diederich
jack at performancedrivers.com
Wed Jun 7 14:41:55 EDT 2006
On Wed, Jun 07, 2006 at 08:17:22PM +0200, Fredrik Lundh wrote:
> Christophe wrote:
>
> > Use /dev/zero as source and /dev/null as destination :D
>
> have you tried looping over an endless null-byte stream?
>
> on a random Linux server, this statement
>
> >>> for line in open("/dev/zero"):
> ... print len(line)
> ...
>
> terminates without printing anything after about three seconds, which is
> a bit odd. in contrast,
>
> >>> f = open("/dev/zero")
> >>> len(f.readline())
>
> raises a MemoryError exception after about 10 seconds. hmm. looks like
> a bug in the file iterator, really...
svn log Objects/fileobject.c
r43506 | georg.brandl | 2006-03-31 15:31:02 -0500 (Fri, 31 Mar 2006) | 2 lines
Bug #1177964: make file iterator raise MemoryError on too big files
So it always the error on the trunk.
-Jack
More information about the Python-list
mailing list