This discussion is getting a little too long than necessary, at least for
me.  :)
Most of pypy talk video is in pretty poor recording quality. Most of the
time I
try to discern barely from the slides.

I always understand the difference between resource lifetime and object
lifetime.
Actually, in my most recent years, my sole python interpreter is
the non-refcounting IronPython already.  And I always wrap file operation
inside try/finally or with statement.

The problem is the example that claim to cause problem:

>>> open('xxx', 'w').write('stuff')

I misinterpret that the problem is caused in the "write" methods.
The above statement cause no problem, but the subsequent usage of
the file will. That's what I missed.
In fact, it might be more intuitive to demonstrate in a little longer
sample.

>>> open('xxx', 'w').write('stuff')
>>> assert open('xxx').read() == 'stuff'    # Might fail ! The first file
might not be closed yet !


Cheers.








On Fri, Aug 20, 2010 at 8:39 PM, Paolo Giarrusso <[email protected]>wrote:

> On Fri, Aug 20, 2010 at 12:23, Donny Viszneki <[email protected]>
> wrote:
> > Armin: Sakesun used "del f" and it appears you did not.
> Actually, he didn't either. He said "I think that open(’xxx’,
> ’w’).write(’stuff’)" is equivalent to using del (which he thought
> would work), and the equivalence was correct.
>
> Anyway, in the _first reply_ message, he realized that using:
>
> ipy -c "open(’xxx’, ’w’).write(’stuff’)"
> jython -c "open(’xxx’, ’w’).write(’stuff’)"
>
> made a difference (because the interpreter exited), so that problem
> was solved. His mail implies that on PyPy he typed the code at the
> prompt, rather than at -c.
>
>
_______________________________________________
[email protected]
http://codespeak.net/mailman/listinfo/pypy-dev

Reply via email to