enthought/distarray — pull request #208 by cowlicks (2014-03-05 22:42:12+00:00)
Title: Global context

This is based off of PR #207 and #160.

This simply sets up a global context at `distarray.world`. This PR is mostly for discussing the best way to do this.

Currently in `__init__.py` ([eeebd75](https://github.com/cowlicks/distarray/commit/eeebd73efb71078631f100008e7130ceafff3e5b)) we just add:
```python

# Set a global context at distarray.world, if it is not already defined.
try:
world
except NameError:
world = Context()
```

However this has drawbacks. *Any* time we try to import distarray or something from distarray this will be run so a global context will unavoidably be set by default. The only way to change it is by mokeypatching `distarray.world` after it has been created. But I can't think of a better solution.