# Buggy code
def __call__(self, *sequences):
    # check that the length of sequences match
    len_0 = len(sequences[0])
    for s in sequences:
        if len(s) != len_0:
            msg = "all sequences must have equal length, but %i!=%i" % (len_0, len(s))
            raise ValueError(msg)
    balanced = "Balanced" in self.view.__class__.__name__
    if balanced:
        if self.chunksize:
            nparts = len_0 // self.chunksize + int(len_0 % self.chunksize > 0)
        else:
            nparts = len_0
        targets = [None] * nparts
    else:
        if self.chunksize:
            warnings.warn("`chunksize` is ignored unless load balancing", UserWarning)
        # multiplexed:
        targets = self.view.targets
        nparts = len(targets)

    msg_ids = []
    # my_f = lambda *a: map(self.func, *a)
    client = self.view.client
    for index, t in enumerate(targets):
        args = []
        for seq in sequences:
            part = self.mapObject.getPartition(seq, index, nparts)
            if len(part) == 0:
                continue
            else:
                args.append(part)
        if not args:
            continue

        # print (args)
        if hasattr(self, "_map"):
            if sys.version_info[0] >= 3:
                f = lambda f, *sequences: list(map(f, *sequences))
            else:
                f = map
            args = [self.func] + args
        else:
            f = self.func

        view = self.view if balanced else client[t]
        with view.temp_flags(block=False, **self.flags):
            ar = view.apply(f, *args)

        msg_ids.append(ar.msg_ids[0])

    r = AsyncMapResult(
        self.view.client,
        msg_ids,
        self.mapObject,
        fname=self.func.__name__,
        ordered=self.ordered,
    )

    if self.block:
        try:
            return r.get()
        except KeyboardInterrupt:
            return r
    else:
        return r


# Traceback (TypeError)
In [3]: v = c.direct_view()

In [4]: v
Out[4]: <DirectView all>

In [5]: v.map_sync(lambda x: x**10, range(32))
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/home/thomas/Code/virtualenvs/ipy-trunk/<ipython-input-5-b937e0334e06> in <module>()
----> 1 v.map_sync(lambda x: x**10, range(32))

/home/thomas/Code/virtualenvs/ipy-trunk/local/lib/python2.7/site-packages/IPython/parallel/client/view.pyc in map_sync(self, f, *sequences, **kwargs)
340             raise TypeError("map_sync doesn't take a `block` keyword argument.")
341         kwargs['block'] = True
--> 342         return self.map(f,*sequences,**kwargs)
343
344     def imap(self, f, *sequences, **kwargs):

/home/thomas/Code/virtualenvs/ipy-trunk/<string> in map(self, f, *sequences, **kwargs)

/home/thomas/Code/virtualenvs/ipy-trunk/local/lib/python2.7/site-packages/IPython/parallel/client/view.pyc in spin_after(f, self, *args, **kwargs)
66 def spin_after(f, self, *args, **kwargs):
67     """call spin after the method."""
---> 68     ret = f(self, *args, **kwargs)
69     self.spin()
70     return ret

/home/thomas/Code/virtualenvs/ipy-trunk/local/lib/python2.7/site-packages/IPython/parallel/client/view.pyc in map(self, f, *sequences, **kwargs)
575         assert len(sequences) > 0, "must have some sequences to map onto!"
576         pf = ParallelFunction(self, f, block=block, **kwargs)
--> 577         return pf.map(*sequences)
578
579     def execute(self, code, targets=None, block=None):

/home/thomas/Code/virtualenvs/ipy-trunk/local/lib/python2.7/site-packages/IPython/parallel/client/remotefunction.pyc in map(self, *sequences)
212         self._map = True
213         try:
--> 214             ret = self.__call__(*sequences)
215         finally:
216             del self._map

/home/thomas/Code/virtualenvs/ipy-trunk/local/lib/python2.7/site-packages/IPython/parallel/client/remotefunction.pyc in __call__(self, *sequences)
185                 f=self.func
186
--> 187             view = self.view if balanced else client[t]
188             with view.temp_flags(block=False, **self.flags):
189                 ar = view.apply(f, *args)

/home/thomas/Code/virtualenvs/ipy-trunk/local/lib/python2.7/site-packages/IPython/parallel/client/client.pyc in __getitem__(self, key)
763         Must be int, slice, or list/tuple/xrange of ints"""
764         if not isinstance(key, (int, slice, tuple, list, xrange)):
--> 765             raise TypeError("key by int/slice/iterable of ints only, not %s"%(type(key)))
766         else:
767             return self.direct_view(key)

TypeError: key by int/slice/iterable of ints only, not <type 'str'>

# Fixed code
def __call__(self, *sequences):
    client = self.view.client

    # check that the length of sequences match
    len_0 = len(sequences[0])
    for s in sequences:
        if len(s) != len_0:
            msg = "all sequences must have equal length, but %i!=%i" % (len_0, len(s))
            raise ValueError(msg)
    balanced = "Balanced" in self.view.__class__.__name__
    if balanced:
        if self.chunksize:
            nparts = len_0 // self.chunksize + int(len_0 % self.chunksize > 0)
        else:
            nparts = len_0
        targets = [None] * nparts
    else:
        if self.chunksize:
            warnings.warn("`chunksize` is ignored unless load balancing", UserWarning)
        # multiplexed:
        targets = self.view.targets
        # 'all' is lazily evaluated at execution time, which is now:
        if targets == "all":
            targets = client._build_targets(targets)[1]
        nparts = len(targets)

    msg_ids = []
    for index, t in enumerate(targets):
        args = []
        for seq in sequences:
            part = self.mapObject.getPartition(seq, index, nparts)
            if len(part) == 0:
                continue
            else:
                args.append(part)
        if not args:
            continue

        # print (args)
        if hasattr(self, "_map"):
            if sys.version_info[0] >= 3:
                f = lambda f, *sequences: list(map(f, *sequences))
            else:
                f = map
            args = [self.func] + args
        else:
            f = self.func

        view = self.view if balanced else client[t]
        with view.temp_flags(block=False, **self.flags):
            ar = view.apply(f, *args)

        msg_ids.append(ar.msg_ids[0])

    r = AsyncMapResult(
        self.view.client,
        msg_ids,
        self.mapObject,
        fname=self.func.__name__,
        ordered=self.ordered,
    )

    if self.block:
        try:
            return r.get()
        except KeyboardInterrupt:
            return r
    else:
        return r