Message413406
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? |
|
Date |
User |
Action |
Args |
2022-02-17 13:13:31 | steven.daprano | set | recipients:
+ steven.daprano, prasechen |
2022-02-17 13:13:30 | steven.daprano | set | messageid: <1645103610.97.0.154211677909.issue46776@roundup.psfhosted.org> |
2022-02-17 13:13:30 | steven.daprano | link | issue46776 messages |
2022-02-17 13:13:30 | steven.daprano | create | |
|