Python object overhead?
Facundo Batista
facundo at taniquetil.com.ar
Fri Mar 23 23:42:54 EDT 2007
Bjoern Schliessmann wrote:
>> while True:
>> line = file.readline()
>> if len(line) == 0: break # EOF
>
> "one blank line" == "EOF"? That's strange. Intended?
>
> The most common form for this would be "if not line: (do
> something)".
"not line" and "len(line) == 0" is the same as long as "line" is a
string.
He's checking ok, 'cause a "blank line" has a lenght > 0 (because of
newline).
>> class FileRecord:
>> def __init__(self, line):
>> self.line = line
>
> What's this class intended to do?
Unless I understood it wrong, it's just an object that holds the line
inside.
Just OO purity, not practicality...
--
. Facundo
.
Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/
More information about the Python-list
mailing list