Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 71f62f1

Browse files
committed
Merged revisions 7834 via svnmerge from
https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_99_maint ........ r7834 | mdboom | 2009-09-30 09:26:36 -0400 (Wed, 30 Sep 2009) | 2 lines Fix Grouper docstring -- it only supports weak-referenceable objects. ........ svn path=/trunk/matplotlib/; revision=7835
1 parent 7f80676 commit 71f62f1

1 file changed

Lines changed: 16 additions & 9 deletions

File tree

lib/matplotlib/cbook.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,21 +1287,28 @@ class Grouper(object):
12871287
using :meth:`joined`, and all disjoint sets can be retreived by
12881288
using the object as an iterator.
12891289
1290-
The objects being joined must be hashable.
1290+
The objects being joined must be hashable and weak-referenceable.
12911291
12921292
For example:
12931293
1294-
>>> g = grouper.Grouper()
1295-
>>> g.join('a', 'b')
1296-
>>> g.join('b', 'c')
1297-
>>> g.join('d', 'e')
1294+
>>> class Foo:
1295+
... def __init__(self, s):
1296+
... self.s = s
1297+
... def __repr__(self):
1298+
... return self.s
1299+
...
1300+
>>> a, b, c, d, e, f = [Foo(x) for x in 'abcdef']
1301+
>>> g = Grouper()
1302+
>>> g.join(a, b)
1303+
>>> g.join(b, c)
1304+
>>> g.join(d, e)
12981305
>>> list(g)
1299-
[['a', 'b', 'c'], ['d', 'e']]
1300-
>>> g.joined('a', 'b')
1306+
[[d, e], [a, b, c]]
1307+
>>> g.joined(a, b)
13011308
True
1302-
>>> g.joined('a', 'c')
1309+
>>> g.joined(a, c)
13031310
True
1304-
>>> g.joined('a', 'd')
1311+
>>> g.joined(a, d)
13051312
False
13061313
"""
13071314
def __init__(self, init=[]):

0 commit comments

Comments
 (0)