¡@

Home 

python Programming Glossary: weakref

Python: Memory leak debugging

http://stackoverflow.com/questions/1339293/python-memory-leak-debugging

list 6157 NavigableString 3479 instance 2454 cell 1256 weakref 974 wrapper_descriptor 836 builtin_function_or_method 766 type.. 27898 2.29 MB code 6907 1.16 MB type 760 653.12 KB weakref 1014 87.14 KB int 3552 83.25 KB function __wrapper__ 702.. a set of done nodes and the list's look like just random weakref s. I didn't use guppy since it required a C extension and I..

Python: Get object by id

http://stackoverflow.com/questions/1396668/python-get-object-by-id

consider implementing it another way. Are you aware of the weakref module Edited The Python weakref module lets you keep references.. way. Are you aware of the weakref module Edited The Python weakref module lets you keep references dictionary references and proxies..

__del__ method being called in python when it is not expected

http://stackoverflow.com/questions/1935153/del-method-being-called-in-python-when-it-is-not-expected

it's not properly a destructor and invoke it using weakref.ref callback. It should NOT be an instance method of course.. 'self' inside the lambda otherwise it won't work. from weakref import ref from time import sleep class Person4 '''Represents..

Should I worry about circular references in Python?

http://stackoverflow.com/questions/2428301/should-i-worry-about-circular-references-in-python

remove unwanted loops of references you can often use the weakref module in Python's standard library. If and when you want to..

Printing all instances of a class

http://stackoverflow.com/questions/328851/printing-all-instances-of-a-class

with types over which you have no control. Use a mixin and weakrefs from collections import defaultdict import weakref class KeepRefs.. and weakrefs from collections import defaultdict import weakref class KeepRefs object __refs__ defaultdict list def __init__.. def __init__ self self.__refs__ self.__class__ .append weakref.ref self @classmethod def get_instances cls for inst_ref in..

What is the __dict__.__dict__ attribute of a Python class?

http://stackoverflow.com/questions/4877290/what-is-the-dict-dict-attribute-of-a-python-class

__dict__ for storing the attributes of the instances __weakref__ which is used internally by weakref and the docstring of the.. of the instances __weakref__ which is used internally by weakref and the docstring of the class. The first two might be gone.. define __slots__ . Then you wouldn't have __dict__ and __weakref__ attributes but instead you'd have a single class attribute..

How to remove lines in a Matplotlib plot

http://stackoverflow.com/questions/4981815/how-to-remove-lines-in-a-matplotlib-plot

does the trick. from matplotlib import pyplot import numpy weakref a numpy.arange int 1e3 fig pyplot.Figure ax fig.add_subplot.. ax fig.add_subplot 1 1 1 lines ax.plot a l lines.pop 0 wl weakref.ref l # create a weak reference to see if references still exist..

Why doesn't the weakref work on this bound method?

http://stackoverflow.com/questions/599430/why-doesnt-the-weakref-work-on-this-bound-method

doesn't the weakref work on this bound method I have a project where i'm trying.. bound method I have a project where i'm trying to use weakrefs with callbacks and I don't understand what I'm doing wrong... is it that in this test test_a works as expected but the weakref for self.MyCallbackB disappears between the class initialization..

Indexable weak ordered set in Python

http://stackoverflow.com/questions/7828444/indexable-weak-ordered-set-in-python

weak reference. from nose.tools import import blist import weakref class WeakOrderedSet blist.weaksortedset A blist.weaksortedset.. order. def __init__ self iterable self.insertion_order weakref.WeakKeyDictionary # value_type to int self.last_key 0 super.. write an OrderedSet. Likewise you can reuse the existing weakref.WeakSet and replace its underlying set with an OrderedSet import..

pybrain: how to print a network (nodes and weights)

http://stackoverflow.com/questions/8150772/pybrain-how-to-print-a-network-nodes-and-weights

' repr ' ' setattr ' ' sizeof ' ' str ' ' subclasshook ' ' weakref ' '_backwardImplementation' '_forwardImplementation' '_generateName'..