re Challenge: More Compact?

Ben Wolfson rumjuggler at cryptarchy.org
Mon Jul 16 01:37:31 EDT 2001


On Mon, 16 Jul 2001 07:06:01 +0300, Moshe Zadka <moshez at zadka.site.co.il>
wrote:

>: import re
>: valid_ip_re = re.compile(r'^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$')
>: def valid_ip(ip):
>:    match = valid_ip_re.match(ip)
>:    if not match:
>:        return
>:    return ![x if int(x)>255 for x in match.groups()]
>  
>And now it's even correct!

s/!/not/ and it is, anyway.

-- 
Barnabas T. Rumjuggler
No man can run so fast that he can escape his own past's projectile vomit.



More information about the Python-list mailing list