[Python-ideas] Automatic context managers

Steven D'Aprano steve at pearwood.info
Thu Apr 25 20:20:36 CEST 2013


On 25/04/13 18:16, Cameron Simpson wrote:

> Then at 25Apr2013 16:17, Steven D'Aprano <steve at pearwood.info> wrote:
> | Citation please. Where is this documented?
>
> Well, the 3.2.3 doco on __del__ says:

Please be more careful about quoting me out of context. I'm perfectly aware of what the docs for __del__ say. I was addressing my question to Anatoly, asking him for documentation for his claims that PySide objects are more deterministic than __del__, that is, that they don't suffer from the same issues regarding circular references and __del__ as other, non-PySide objects. I won't categorically say that's impossible, but I find it an extraordinary claim that requires more evidence than just one person's say so.


[...]
> Reference counting makes __del__ fairly predictable if you have
> tight control over the references to an object. Not always the case
> of course. And other Pythons don't necessarily do reference counting
> unless I misremember.

You remember correctly. IronPython and Jython use the .Net and Java virtual machines, including their garbage collectors, neither of which are reference counting. (In fact, there's often a fair bit of snobbery in Java circles about CPython's ref counting not being a "real" GC.) PyPy can use various GCs, selected at build-time (I think), including a ref counting one. I don't know about other implementations.



-- 
Steven



More information about the Python-ideas mailing list