cdef long neg = -1
cdef unsigned long pos = -2 # will be a large positive number
- print "neg", neg > 0
- print "pos", pos > 0
+ print u"neg", neg > 0
+ print u"pos", pos > 0
- D = { neg: 'neg', pos: 'pos' }
+ D = { neg: u'neg', pos: u'pos' }
print D[<object>neg]
print D[<object>pos]
>>> modint(9,2)
1
+"""
+
+import sys
+if sys.version_info[0] < 3:
+ __doc__ = __doc__ + u"""
- >>> print modptr()
- spameggs
+ >>> modptr()
+ 'spameggs'
"""
def modobj(obj2, obj3):
str2 = "spam%s"
str3 = "eggs"
- obj1 = str2 % str3
- return obj1.decode(u"ASCII")
+ obj1 = str2 % str3 # '%' operator doesn't work on byte strings in Py3
+ return obj1