parameters: (self, host='localhost', port=0, source_address=None)
return_statement: return (code, msg)
docstring: Connect to a host on a given port.
  
          If the hostname ends with a colon (`:') followed by a number, and
          there is no port specified, that suffix will be stripped off and the
          number interpreted as the port number to use.
  
          Note: This method is automatically invoked by __init__, if a host is
          specified during instantiation.
docstring_summary: Connect to a host on a given port.
docstring_tokens: Connect to a host on a given port .
function: def connect(self, host='localhost', port=0, source_address=None):
          """Connect to a host on a given port.
  
          If the hostname ends with a colon (`:') followed by a number, and
          there is no port specified, that suffix will be stripped off and the
          number interpreted as the port number to use.
  
          Note: This method is automatically invoked by __init__, if a host is
          specified during instantiation.
  
          """
  
          if source_address:
              self.source_address = source_address
  
          if not port and (host.find(':') == host.rfind(':')):
              i = host.rfind(':')
              if i >= 0:
                  host, port = host[:i], host[i + 1:]
                  try:
                      port = int(port)
                  except ValueError:
                      raise OSError("nonnumeric port")
          if not port:
              port = self.default_port
          sys.audit("smtplib.connect", self, host, port)
          self.sock = self._get_socket(host, port, self.timeout)
          self.file = None
          (code, msg) = self.getreply()
          if self.debuglevel > 0:
              self._print_debug('connect:', repr(msg))
          return (code, msg)
function_tokens: def connect ( self , host = 'localhost' , port = 0 , source_address = None ) : if source_address : self . source_address = source_address if not port and ( host . find ( ':' ) == host . rfind ( ':' ) ) : i = host . rfind ( ':' ) if i >= 0 : host , port = host [ : i ] , host [ i + 1 : ] try : port = int ( port ) except ValueError : raise OSError ( "nonnumeric port" ) if not port : port = self . default_port sys . audit ( "smtplib.connect" , self , host , port ) self . sock = self . _get_socket ( host , port , self . timeout ) self . file = None ( code , msg ) = self . getreply ( ) if self . debuglevel > 0 : self . _print_debug ( 'connect:' , repr ( msg ) ) return ( code , msg )