Did I find the right examples for you? yes no

All Samples(14)  |  Call(9)  |  Derive(0)  |  Import(5)
Fancy indexing with tuples 

        def index(tup, ind):
    """ Fancy indexing with tuples """
    return tuple(tup[i] for i in ind)
        


src/l/o/logic-0.1.10/logpy/facts.py   logic(Download)
from util import intersection, index, merge
from core import conde, reify, isvar
 
class Relation(object):
    _id = 0
            varinds = [i for i, arg in enumerate(args2) if isvar(arg)]
            valinds = [i for i, arg in enumerate(args2) if not isvar(arg)]
            vars = index(args2, varinds)
            vals = index(args2, valinds)
            assert not any(var in s for var in vars)
 
            return (merge(dict(zip(vars, index(fact, varinds))), s)
                              for fact in self.facts
                              if vals == index(fact, valinds))

src/l/o/logpy-HEAD/logpy/facts.py   logpy(Download)
from .util import intersection, index
from .core import conde, reify, isvar
from toolz import merge
 
class Relation(object):
            varinds = [i for i, arg in enumerate(args2) if isvar(arg)]
            valinds = [i for i, arg in enumerate(args2) if not isvar(arg)]
            vars = index(args2, varinds)
            vals = index(args2, valinds)
            assert not any(var in s for var in vars)
 
            return (merge(dict(zip(vars, index(fact, varinds))), s)
                              for fact in self.facts
                              if vals == index(fact, valinds))

src/l/o/logpy-HEAD/logpy/assoccomm.py   logpy(Download)
from .facts import Relation
from logpy import core
from .util import groupsizes, index
from .util import transitive_get as walk
from .term import term, arguments, operator
    [('a', 'b'), ('e', 'd', 'c')]
    """
    return [index(tup, ind) for ind in part]
 
def groupsizes_to_partition(*gsizes):

src/l/o/logic-0.1.10/logpy/core.py   logic(Download)
import itertools as it
from util import transitive_get as walk
from util import deep_transitive_get as walkstar
from util import (assoc, unique, dicthash, interleave, take, evalt,
        groupby, index)

src/l/o/logpy-HEAD/logpy/core.py   logpy(Download)
import itertools as it
from functools import partial
from .util import transitive_get as walk
from .util import deep_transitive_get as walkstar
from .util import (dicthash, interleave, take, evalt, index, multihash, unique)