From b111c56b06a435826866f744cd1ad84fa6e599b5 Mon Sep 17 00:00:00 2001 From: David Halter Date: Tue, 4 Sep 2012 16:21:17 +0200 Subject: [PATCH] added _weakref mixins --- mixin/_weakref.py | 8 ++++++++ test/completion/std.py | 13 +++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 mixin/_weakref.py diff --git a/mixin/_weakref.py b/mixin/_weakref.py new file mode 100644 index 00000000..05eab2c8 --- /dev/null +++ b/mixin/_weakref.py @@ -0,0 +1,8 @@ +def proxy(object, callback=None): + return object + +class ref(): + def __init__(self, object, callback=None): + self.__object = object + def __call__(self): + return self.__object diff --git a/test/completion/std.py b/test/completion/std.py index 098fb375..fe5ab73b 100644 --- a/test/completion/std.py +++ b/test/completion/std.py @@ -18,3 +18,16 @@ next(re.finditer('a', 'a')).start() #? str() re.sub('a', 'a') + +# ----------------- +# ref +# ----------------- +import weakref + +#? int() +weakref.proxy(1) + +#? weakref.ref +weakref.ref(1) +#? int() +weakref.ref(1)()