[Python-Dev] _socket efficiencies ideas (original) (raw)

Sean Reifschneider jafo@tummy.com
Wed, 9 Apr 2003 14:33:19 -0600


On Wed, Apr 09, 2003 at 01:44:51PM -0500, Skip Montanaro wrote:

Can a top-level domain be all digits? If not, why not assume numeric if re.search(r".\d+$", addr) is not None?

I don't think anyone sane would create a top-level that's digits, particularly in the range of 0 to 255. That probably means that somebody is going to do it... ;-/

I think checking for 2 to 4 dotted octets in the range of 0 to 255 would be safest... Yes, you can probably get away with using the regex above, but I wouldn't want to.

Sean

Sucking all the marrow out of life doesn't mean choking on the bone. -- Dead_Poet's_Society Sean Reifschneider, Inimitably Superfluous <jafo@tummy.com> tummy.com, ltd. - Linux Consulting since 1995. Qmail, Python, SysAdmin