[Tutor] AttributeError in class Today

Raymond Hettinger python@rcn.com
Fri, 31 May 2002 17:53:57 -0400


From: "Thomas Rivas" <trivas7@rawbw.com>


> Hi all -- Newbie question here:
> 
> When I rum Listing 10.7 from 'Teach Yourself Python in 24 Hours:'
> 
> #!/usr/local/bin/python
> import time
> import now
> class today(now.now):
>     def __init__(self, y = 1970):
>         now.now.__init__(self)
>     def update(self,tt):
>         if len(tt) < 9:
>             raise TypeError
>         if tt[0] < 1970 or tt[0] > 2038:
>             raise OverflowError
>         self.t = time.mktime(tt)
>         self(self.t)

                  ^^^^^^   should these have been types as brackets ?
            self[self.t]




Raymond Hettinger