On Fri, Jun 25, 2021 at 1:54 PM Ricky Teachey <ri...@teachey.org> wrote:
>
> Would this feature allow me to declare str objects as not iterable in some 
> contexts?
>
> If so, +1.
>

That depends. If the proposal is to intercept every attribute lookup
(parallel to a class's __getattribute__ method), then yes, but if it's
a fallback after default behaviour fails (like __getattr__), then no.
I suspect that the latter is more likely; it's much easier to avoid
recursion problems if real attributes are tried first, plus it's
likely to impact performance a lot less.

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/TIYNGARJNUV6VBYFRRDHNH7NJPSHPHZF/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to