On Thu, Jun 15, 2017 at 6:54 AM, Barry Scott <ba...@barrys-emacs.org> wrote:
>> class Magic:
>>    def __getattr__(self, attr):
>>        if attr in self.generatables:
>>            return self.generated_value(attr)
>>        raise AttributeError
>>    def __dir__(self):
>>        return default_dir(self) + self.generatables
>>
>> For that purpose, is it possible to use super().__dir__()? Are there
>> any considerations where that would fail?
>
> Remember that I need to do this in the C API and I want default_dir of self 
> in C not python.
>
> super().__dir__ looks at the class above me that is typically object() and so 
> is not useful
> as it does not list the member function from my class or __mro__ or other 
> stuff I may not be aware of
> that is important to return.

Right, thank you. That's the bit I wasn't aware of - the reason that
__dir__ can't be used. So in terms of defining the problem, this is a
solid piece of info.

ChrisA
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to