Maksim Kasimov wrote:

sorry for my question, but i've read the documentation, and can't find where is the explanation of how it is exactly works (but of course i do believe you). If it is buit in function, can i see the source code of the method to find it out?


Kent Johnson wrote:
http://docs.python.org/lib/built-in-funcs.html

From the above page: open( filename[, mode[, bufsize]]) An alias for the file() function above.

file(   filename[, mode[, bufsize]])
    Return a new file object (described in section 2.3.9, ``File Objects'').

http://docs.python.org/lib/bltin-file-objects.html

2.3.9 File Objects

next( )
A file object is its own iterator, for example iter(f) returns f (unless f is closed). When a file is used as an iterator, typically in a for loop (for example, for line in f: print line), the next() method is called repeatedly. This method returns the next input line, or raises StopIteration when EOF is hit. <etc>


or look at Objects/fileobject.c in the source code.

Kent
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to