Kaushik wrote:

> Hi,
> i'm new to python , and i came across a code like
> 
> if ("on_%s" % handler ) in self._dir:
> 
> i tried use the a similar method in my class it errors out like
> 
> AttributeError: bot instance has no attribute '_dir'
> 
> what am i doing wrong?

self._dir is just an attribute that has previously been set somewhere. For
example, like this:

class Foo(object):
   def __init__(self):
       self._dir = "I'm a fancy value"

So without you providing more code I presume you try to subclass something
and didn't properly set up the base-class - probably missing a call to the
super class' constructor.

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

Reply via email to