9
def print_large_number(n):
10
print(str(n).rstrip('L'))
13
DEF TUPLE = (1, 2, u"buckle my shoe")
14
DEF TRUE_FALSE = (True, False)
23
DEF LARGE_NUM32 = (1 << 32) - 1
24
DEF LARGE_NUM64 = (1 << 64) - 1
26
DEF EXACT_FLOAT = 0.577215664901532860606512090082402431
27
DEF E_FLOAT = 0.5772156E4 # Cannot currently warn about this since we can't safely compare the string repr.
29
DEF UNICODE = u"spam-u"
32
DEF TRUE = TRUE_FALSE[0]
33
DEF FALSE = TRUE_FALSE[1]
34
DEF INT_TUPLE1 = TUPLE[:2]
35
DEF INT_TUPLE2 = TUPLE[1:4:2]
37
DEF EXPRESSION = int(float(2*2)) + int(str(2)) + int(max(1,2,3)) + sum([TWO, FIVE])
38
DEF UNICODE_EXPRESSION = unicode(BYTES.decode('utf8')).encode('ascii').decode('latin1')
91
>>> ul32, ul64, l64, n64 = large_nums()
92
>>> print_large_number(ul32)
94
>>> print_large_number(ul64)
96
>>> print_large_number(l64)
98
>>> print_large_number(n64)
101
cdef unsigned long ul32 = LARGE_NUM32
102
cdef unsigned long long ul64 = LARGE_NUM64
103
cdef long long l64 = LARGE_NUM32
104
cdef long long n64 = -LARGE_NUM32
105
return ul32, ul64, l64, n64
125
>>> t, s = type_of_bytes()
126
>>> assert t is bytes, t
127
>>> assert type(s) is bytes, type(s)
133
def type_of_unicode():
135
>>> t, s = type_of_unicode()
136
>>> assert t is _unicode, t
137
>>> assert type(s) is _unicode, type(s)
143
@cython.test_assert_path_exists('//TupleNode')
146
>>> constant_tuple()[:-1]
148
>>> print(constant_tuple()[-1])
151
cdef object t = TUPLE
154
@cython.test_assert_path_exists('//IntNode')
160
cdef int two = INT_TUPLE1[-1]
179
@cython.test_assert_path_exists('//BoolNode')
185
cdef bint true = TRUE
188
@cython.test_assert_path_exists('//BoolNode')
194
cdef bint false = FALSE
204
@cython.test_assert_path_exists('//IntNode')
205
@cython.test_fail_if_path_exists('//AddNode')
211
cdef int i = EXPRESSION
215
def unicode_expression():
217
>>> print(unicode_expression())
220
s = UNICODE_EXPRESSION
232
24:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
233
25:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
234
26:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
235
28:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
236
29:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
237
30:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
238
31:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
239
32:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
240
33:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
241
34:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
242
35:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
243
36:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
244
37:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
245
37:18: Using this floating point value with DEF may lose precision, using 0.5772156649015329
246
38:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
247
39:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
248
40:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
249
41:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
250
42:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
251
43:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
252
44:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
253
45:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
254
46:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
255
47:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
256
48:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
257
49:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
261
26:18: Using this floating point value with DEF may lose precision, using 0.5772156649015329