diff --git a/core/build.sh b/core/build.sh index 56acb50..5cbfc38 100755 --- a/core/build.sh +++ b/core/build.sh @@ -15,8 +15,8 @@ echo "- translating from Python to C" cython -f -3 --fast-fail -X embedsignature=True cython_types.pyx -o cython_types.c || die "translating" echo "- compiling and linking" -gcc $CFLAGS -I/usr/include/python3.4 -pthread -c cython_types.c || die "compilation" -gcc $LFLAGS -L/usr/lib -lpython3.4 cython_types.o -o cython_types.so || die "linking" +gcc $CFLAGS -I/usr/include/python3.5m -pthread -c cython_types.c || die "compilation" +gcc $LFLAGS -L/usr/lib -lpython3.5m cython_types.o -o cython_types.so || die "linking" rm -f cython_types.{c,o} echo "- done" diff --git a/core/cython_types.pyx b/core/cython_types.pyx index a881016..c3f569a 100644 --- a/core/cython_types.pyx +++ b/core/cython_types.pyx @@ -44,10 +44,7 @@ class map: ''' if source: - if len(source[0]) == len(source[1]): - self.keys, self.vals = source - else: - raise ValueError('over.core.types.map initialized with two sequences of different lengths') + self.keys, self.vals = zip(*source) else: self.keys = [] self.vals = [] diff --git a/core/m.py b/core/m.py index 6c75076..2f36f5f 100644 --- a/core/m.py +++ b/core/m.py @@ -12,6 +12,7 @@ class compare_float: self.eq = False self.ge = True self.gt = False + self.ne = False if A < (B - epsilon): self.lt = True @@ -22,6 +23,8 @@ class compare_float: if abs(A - B) < epsilon: self.eq = True + else: + self.ne = True # convenience self.less = self.lt @@ -29,6 +32,7 @@ class compare_float: self.equal = self.eq self.greater_or_equal = self.ge self.greater = self.gt + self.not_equal = self.ne if __name__ == '__main__': x = compare_float(1, 2, 0.5) diff --git a/core/python_types.py b/core/python_types.py index 2a4cdeb..3b2c573 100644 --- a/core/python_types.py +++ b/core/python_types.py @@ -44,10 +44,7 @@ class map: ''' if source: - if len(source[0]) == len(source[1]): - self.keys, self.vals = source - else: - raise ValueError('over.core.types.map initialized with two sequences of different lengths') + self.keys, self.vals = zip(*source) else: self.keys = [] self.vals = []