parameters: (host, defport=-1)
return_statement: return host, defport
docstring: Split host and port, returning numeric port.
      Return given default port if no ':' found; defaults to -1.
      Return numerical port if a valid number are found after ':'.
      Return None if ':' but not a valid number.
docstring_summary: Split host and port, returning numeric port.
      Return given default port if no ':' found; defaults to -1.
      Return numerical port if a valid number are found after ':'.
      Return None if ':' but not a valid number.
docstring_tokens: Split host and port returning numeric port . Return given default port if no : found ; defaults to - 1 . Return numerical port if a valid number are found after : . Return None if : but not a valid number .
function: def splitnport(host, defport=-1):
      """Split host and port, returning numeric port.
      Return given default port if no ':' found; defaults to -1.
      Return numerical port if a valid number are found after ':'.
      Return None if ':' but not a valid number."""
      global _nportprog
      if _nportprog is None:
          import re
          _nportprog = re.compile('^(.*):(.*)$')
  
      match = _nportprog.match(host)
      if match:
          host, port = match.group(1, 2)
          try:
              if not port: raise ValueError, "no digits"
              nport = int(port)
          except ValueError:
              nport = None
          return host, nport
      return host, defport
function_tokens: def splitnport ( host , defport = - 1 ) : global _nportprog if _nportprog is None : import re _nportprog = re . compile ( '^(.*):(.*)$' ) match = _nportprog . match ( host ) if match : host , port = match . group ( 1 , 2 ) try : if not port : raise ValueError , "no digits" nport = int ( port ) except ValueError : nport = None return host , nport return host , defport