##// END OF EJS Templates
pycompat: add helper to iterate each char in bytes
Yuya Nishihara -
r31382:c9fd842d default
parent child Browse files
Show More
@@ -76,6 +76,10 b' if ispy3:'
76 76 def bytechr(i):
77 77 return bytes([i])
78 78
79 def iterbytestr(s):
80 """Iterate bytes as if it were a str object of Python 2"""
81 return iter(s[i:i + 1] for i in range(len(s)))
82
79 83 def sysstr(s):
80 84 """Return a keyword str to be passed to Python functions such as
81 85 getattr() and str.encode()
@@ -142,6 +146,7 b' else:'
142 146 import cStringIO
143 147
144 148 bytechr = chr
149 iterbytestr = iter
145 150
146 151 def sysstr(s):
147 152 return s
General Comments 0
You need to be logged in to leave comments. Login now