File tree Expand file tree Collapse file tree 3 files changed +19
-0
lines changed Expand file tree Collapse file tree 3 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,9 @@ namespace pythonic
5151 using const_iterator = xrange_iterator;
5252 using reverse_iterator = xrange_riterator;
5353 using const_reverse_iterator = xrange_riterator;
54+ using dtype = value_type;
55+ static constexpr bool is_vectorizable = false ;
56+ static constexpr size_t value = 1 ;
5457
5558 long _begin;
5659 long _end;
Original file line number Diff line number Diff line change @@ -17,6 +17,11 @@ namespace pythonic
1717 }
1818 }
1919
20+ namespace __builtin__
21+ {
22+ struct xrange ;
23+ }
24+
2025 namespace types
2126 {
2227
@@ -144,6 +149,10 @@ namespace pythonic
144149 struct is_numexpr_arg <itertools::details::izip<F, V...>> : std::true_type {
145150 };
146151
152+ template <>
153+ struct is_numexpr_arg <__builtin__::xrange> : std::true_type {
154+ };
155+
147156 template <class E >
148157 struct dtype_of {
149158 template <class T >
Original file line number Diff line number Diff line change @@ -66,6 +66,13 @@ def np_sum_izip(a):
6666 return np.sum(izip(a, a))
6767 """ , range (10 ), np_sum_izip = [[int ]])
6868
69+ def test_sum_xrange (self ):
70+ self .run_test ("""
71+ def np_sum_xrange(a):
72+ import numpy as np
73+ return np.sum(xrange(a))
74+ """ , 10 , np_sum_xrange = [int ])
75+
6976 def test_prod_ (self ):
7077 """ Check prod function for numpy array. """
7178 self .run_test ("""
You can’t perform that action at this time.
0 commit comments