I’m not sure I see that as the cause of this particular issue as it occurs in Python rather than PHP, and I personally expect a constructor to be evaluated when it is called rather than when it is defined. Perhaps that’s just me though! A fairer comparison might be with temporary loop counter variables such as for( $i = 0; $i < count( $array ); ++$i ) { ... } going out of scope when the loop ends, but again that’s a construct that’s rarely used in Python.
I’m not sure I see that as the cause of this particular issue as it occurs in Python rather than PHP, and I personally expect a constructor to be evaluated when it is called rather than when it is defined. Perhaps that’s just me though! A fairer comparison might be with temporary loop counter variables such as
for( $i = 0; $i < count( $array ); ++$i ) { ... }going out of scope when the loop ends, but again that’s a construct that’s rarely used in Python.