Steven D'Aprano <steve+pyt...@pearwood.info> added the comment:

This is not a bug, Python is working correctly here. The interpreter is doing 
exactly what you told it to do, and then raising a RecursionError before you 
can crash the system.


You have a property instance.bar which returns instance.bar, which returns 
instance.bar, which returns instance.bar... forever, or until RecursionError is 
triggered.

Your class is the same as:

class Foo:
    @property
    def bar(self):
        return self.bar

So when you call instance.bar, it looks up bar, which is the property, which 
looks up bar, which is the property, which looks up bar, and so on.

What did you expect to happen?

----------
nosy: +steven.daprano
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46776>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to