Got it.


On Fri, Mar 14, 2014 at 3:26 PM, Mark Kness <notifications@github.com>wrote:

> In distarray/context.py:
>
> > +    def purge_keys(self, all_other_contexts=False):
> > +        """ Delete keys that this context created from all the engines.
> > +
> > +        If all_other_contexts is False (the default), then this
> > +        deletes from the engines all the keys from only this context.
> > +        Otherwise, it deletes all keys from all other contexts.
> > +
> > +        """
> > +        basename = self._key_basename()
> > +        prefix = self._key_prefix()
> > +        if all_other_contexts:
> > +            # Delete distarray keys from all contexts except this one.
> > +            cmd = """for k in list(globals().keys()):
> > +                         if (k.startswith('%s')) and (not k.startswith('%s')):
> > +                             del globals()[k]""" % (basename, prefix)
> > +        else:
>
> I think the else is needed. The logic is choosing one command or the
> other to run, either to get all distarray keys and skip the ones for this
> context (for the all_other_contexts == True case), or to get the
> distarray keys just for this context (for the else case.)
>
> Note that the first case is getting all keys with names starting with
> _distarray_key, ignoring the part of the name with the context id, and
> explicitly discarding those from this context, while the second case (else)
> is getting the keys with the desired context name in them.
>
> --
> Reply to this email directly or view it on GitHub<https://github.com/enthought/distarray/pull/174/files#r10625451>
> .
>