[Tutor] Logfile multiplexing

Stephen Nelson-Smith sanelson at gmail.com
Tue Nov 10 14:42:21 CET 2009


Hi,

> probably that line should have been " ".join(line.split()[3:5]), i.e.
> no self. The line variable is a supplied argument.

Now I get:


Python 2.4.3 (#1, Jan 21 2009, 01:11:33)
[GCC 4.1.2 20071124 (Red Hat 4.1.2-42)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import kent
>>> kent.l
<kent.LogFile instance at 0x2b375eac0b90>
>>> for a, b in kent.l
  File "<stdin>", line 1
    for a, b in kent.l
                     ^
SyntaxError: invalid syntax
>>> for a, b in kent.l:
...   print a, b
...
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "kent.py", line 11, in __iter__
    if stamp.startswith(date):
NameError: global name 'date' is not defined

How does __iter__ know about date?  Should that be self.date?

S.


More information about the Tutor mailing list