[pypy-dev] JITability
Serhat Sevki Dincer
jfcgauss at gmail.com
Mon Jan 30 16:52:00 CET 2012
Hi,
Suppose you have a function to validate local/international phone numbers
(one space between number groups, no space at start/end, no zero at start)
like:
def validatePhone(v):
if not (9 < len(v) < 19 and '0' < v[0]): *# recall ' ' < '0'*
return False
for c in v:
if '0' <= c <= '9':
wasspace = False
else:
if c != ' ' or wasspace:
return False
wasspace = True
if wasspace:
return False # last one
return True
Just out of curiosity, would JITability of this function change if I put
"wasspace = False" just before the loop ?
Note: attaching just in case indentation is lost when sending..
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20120130/46fd1b55/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: phone.py
Type: text/x-python
Size: 279 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20120130/46fd1b55/attachment.py>
More information about the pypy-dev
mailing list