|
From: Eric F. <ef...@ha...> - 2009-09-29 21:42:37
|
TP wrote: > Hi everybody, > > I try to play with "sharex" feature. Then, I have been guided to the > class "Grouper" of module cbook: > > http://matplotlib.sourceforge.net/api/cbook_api.html > > So I tried the following example: > > ############################## > from matplotlib.cbook import * > > g = Grouper() > g.join('a', 'b') > ############################## > > I obtain: > > Traceback (most recent call last): > File "test_grouper.py", line 4, in <module> > g.join('a', 'b') > File ".../matplotlib/cbook.py", line 1118, in join > set_a = mapping.setdefault(ref(a), [ref(a)]) > TypeError: cannot create weak reference to 'str' object > > What is the problem? Grouper is implemented using weak references, which are supported only for some types of objects, as described here: http://docs.python.org/library/weakref.html Evidently the cbook Grouper docstring was written when the implementation was different, and did not use weakref. So, you have found a major bug in the docstring. Eric > > Thanks in advance, > > Julien > |