On Tue, Jun 22, 2021 at 8:01 PM Steven D'Aprano <st...@pearwood.info> wrote:
> The whole point of extension methods is that once the caller opts in to
> use them, method look ups (and that includes hasattr and getattr) must
> work as if the extension methods **are in place**.
>
> The must be no semantic difference between:
>
>     obj.method(arg)
>
> and
>
>     getattr(obj, 'method')(arg)
>
> regardless of whether `method` is a regular method or an extension
> method.
>

And this is a problem. How is getattr defined? Is it counted as being
in the current module? If it is, then has getattr magically become
part of the module it's called from? Or do ALL lookups depend on where
the function was called, rather than where it's defined?

If 'method' is an extension method, where exactly is it visible?

ChrisA
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/5YRFIE3O42WN3TCLLLR2NR5M6DZ2SUJU/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to