[EMAIL PROTECTED] wrote: > Hello all, > > in python2.4, i read lines from a file with > > for lineNum, line in enumerate(f): ... > > However, lineNum soon overflows and starts counting backwards. How do > i force enumerate to return long integer? > Just how "soon" exactly do you read sys.maxint lines from a file? I should have thought that it would take a significant amount of time to read 2,147,483,647 lines ...
But it is true that Python 2.5 uses an enumobject representation that limits the index to a (C) long: typedef struct { PyObject_HEAD long en_index; /* current index of enumeration */ PyObject* en_sit; /* secondary iterator of enumeration */ PyObject* en_result; /* result tuple */ } enumobject; regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://del.icio.us/steve.holden Sorry, the dog ate my .sigline -- http://mail.python.org/mailman/listinfo/python-list