I'm not sure why I'm getting an error at the end here:

>>> class dummy:
...     def __init__(self,dur=0):
...             self.dur=dur
...
>>> z=dummy(3)
>>> z.dur
3
>>> z=dummy(dur=3)
>>> z.dur
3

That worked fine, of course.

>>> class dummy2(str):
...     def __init__(self,dur=0):
...             self.dur=dur
...
>>> z=dummy2(3)
>>> z.dur
3

So far so good.  But:

>>> z=dummy2(dur=3)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'dur' is an invalid keyword argument for this function
>>>

Why doesn't that last bit work? I'm not sure where to begin to look this up.
Thanks!

--
-dave----------------------------------------------------------------
"Pseudo-colored pictures of a person's brain lighting up are
undoubtedly more persuasive than a pattern of squiggles produced by a
polygraph.  That could be a big problem if the goal is to get to the
truth."  -Dr. Steven Hyman, Harvard



_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to