On Jul 3, 5:34 am, Jack Diederich jackd...@gmail.com wrote:
On Thu, Jul 2, 2009 at 2:36 PM, Carl Bankspavlovevide...@gmail.com wrote:
Warning: objects with a __del__ attribute prevent reference cycle
detection, which can potentially lead to memory (and resource) leaks.
So you must be
Thanks to all that answered, in particular I wasn't aware of the existence
of the __del__ function.
For completeness' sake, I think I have found another way to not really solve
but at least circumvent the problem: weak references. If I understand
correctly, those would allow me to pass out
On Thu, Jul 2, 2009 at 2:36 PM, Carl Bankspavlovevide...@gmail.com wrote:
On Jul 2, 3:12 am, Ulrich Eckhardt eckha...@satorlaser.com wrote:
Bearophile wrote:
Ulrich Eckhardt:
a way to automatically release the resource, something
which I would do in the destructor in C++.
Is this
Dave Angel da...@dejaviewphoto.com wrote:
You're right of course. What I was trying to say was it deletes the
reference to the object. Unlike obj = None, del obj removes the
reference (attribute) entirely. Although I don't know what it should be
called if it's a local variable. Perhaps
In article ftps459nklqio3nghaaraniqo3fs9r8...@4ax.com,
Tim Roberts t...@probo.com wrote:
Dave Angel da...@dejaviewphoto.com wrote:
You're right of course. What I was trying to say was it deletes the
reference to the object. Unlike obj = None, del obj removes the
reference (attribute)
Hi!
I'm currently converting my bioware to handle Python code and I have
stumbled across a problem...
Simple scenario: I have a handle to a resource. This handle allows me to
manipulate the resource in various ways and it also represents ownership.
Now, when I put this into a class, instances to
Ulrich Eckhardt:
a way to automatically release the resource, something
which I would do in the destructor in C++.
Is this helpful?
http://effbot.org/pyref/with.htm
Bye,
bearophile
--
http://mail.python.org/mailman/listinfo/python-list
Bearophile wrote:
Ulrich Eckhardt:
a way to automatically release the resource, something
which I would do in the destructor in C++.
Is this helpful?
http://effbot.org/pyref/with.htm
Yes, it aims in the same direction. However, I'm not sure this applies to my
case. The point is that the
Ulrich Eckhardt wrote:
Bearophile wrote:
Ulrich Eckhardt:
a way to automatically release the resource, something
which I would do in the destructor in C++.
Is this helpful?
http://effbot.org/pyref/with.htm
Yes, it aims in the same direction. However, I'm not sure this applies to
my
Ulrich Eckhardt wrote:
Hi!
I'm currently converting my bioware to handle Python code and I have
stumbled across a problem...
Simple scenario: I have a handle to a resource. This handle allows me to
manipulate the resource in various ways and it also represents ownership.
Now, when I put this
Dave Angel wrote:
Look also at 'del' a command in the language which explicitly deletes an
object.
No, you are either explaining it the wrong way or you have been fallen
for a common misinterpretation of the del statement. The del statement
only removes the object from the current scope. This
Dave Angel wrote:
But I'm guessing you want something that automatically deletes objects
whenever the last reference disappears. That's an implementation
detail, not a language guarantee. In particular CPython does what you
want, by using reference counting. That's the only Python I've
Christian Heimes wrote:
Dave Angel wrote:
Look also at 'del' a command in the language which explicitly deletes an
object.
No, you are either explaining it the wrong way or you have been fallen
for a common misinterpretation of the del statement. The del statement
only removes the
On Jul 2, 3:12 am, Ulrich Eckhardt eckha...@satorlaser.com wrote:
Bearophile wrote:
Ulrich Eckhardt:
a way to automatically release the resource, something
which I would do in the destructor in C++.
Is this helpful?
http://effbot.org/pyref/with.htm
Yes, it aims in the same direction.
Peter Otten schreef:
Ulrich Eckhardt wrote:
Bearophile wrote:
Ulrich Eckhardt:
a way to automatically release the resource, something
which I would do in the destructor in C++.
Is this helpful?
http://effbot.org/pyref/with.htm
Yes, it aims in the same direction. However, I'm not sure
You can go ahead and implement a __del__() method. It will often work in
CPython, but you get no guarantees, especially when you have reference
cycles and with other Python implementations that don't use refcounting.
And for resources whose lifetime is greater than your process (e.g. a
file),
16 matches
Mail list logo