help on self._dir

Kaushik kaushiknfs at gmail.com
Tue Jun 10 04:58:59 EDT 2008


On Jun 9, 8:13 pm, "Diez B. Roggisch" <de... at nospam.web.de> wrote:
> 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

Thanks Diez! that explains a lot :)




More information about the Python-list mailing list