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

Skip to content

Commit aef2600

Browse files
committed
added a namespace trick
svn path=/trunk/matplotlib/; revision=3521
1 parent 36d0aa4 commit aef2600

2 files changed

Lines changed: 320 additions & 321 deletions

File tree

lib/matplotlib/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,3 +870,15 @@ def get_info(self, s):
870870
an example
871871
"""
872872
pass
873+
874+
875+
876+
class Namespace:
877+
"""
878+
A class which takes a list of modules and creates an object with
879+
the module naems at attrs
880+
"""
881+
def __init__(self, *modules):
882+
def make_key(x): return x.__name__.replace('matplotlib.', '')
883+
self.__dict__ = dict([(make_key(m), m) for m in modules])
884+

0 commit comments

Comments
 (0)