2012/1/30 Serhat Sevki Dincer <[email protected]>:
> 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 ?

It likely doesn't matter unless you expect phone numbers to be longer
than 1000 chars.


-- 
Regards,
Benjamin
_______________________________________________
pypy-dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to