Use sets instead of lists for membership testing

This commit is contained in:
Raymond Hettinger 2004-05-06 16:55:07 +00:00
parent 30633c9a64
commit 6924a00d10
1 changed files with 12 additions and 12 deletions

View File

@ -8,22 +8,22 @@ __all__ = ["urlparse", "urlunparse", "urljoin", "urldefrag",
"urlsplit", "urlunsplit"] "urlsplit", "urlunsplit"]
# A classification of schemes ('' means apply by default) # A classification of schemes ('' means apply by default)
uses_relative = ['ftp', 'http', 'gopher', 'nntp', 'imap', uses_relative = set(['ftp', 'http', 'gopher', 'nntp', 'imap',
'wais', 'file', 'https', 'shttp', 'mms', 'wais', 'file', 'https', 'shttp', 'mms',
'prospero', 'rtsp', 'rtspu', ''] 'prospero', 'rtsp', 'rtspu', ''])
uses_netloc = ['ftp', 'http', 'gopher', 'nntp', 'telnet', uses_netloc = set(['ftp', 'http', 'gopher', 'nntp', 'telnet',
'imap', 'wais', 'file', 'mms', 'https', 'shttp', 'imap', 'wais', 'file', 'mms', 'https', 'shttp',
'snews', 'prospero', 'rtsp', 'rtspu', ''] 'snews', 'prospero', 'rtsp', 'rtspu', ''])
non_hierarchical = ['gopher', 'hdl', 'mailto', 'news', non_hierarchical = set(['gopher', 'hdl', 'mailto', 'news',
'telnet', 'wais', 'imap', 'snews', 'sip'] 'telnet', 'wais', 'imap', 'snews', 'sip'])
uses_params = ['ftp', 'hdl', 'prospero', 'http', 'imap', uses_params = set(['ftp', 'hdl', 'prospero', 'http', 'imap',
'https', 'shttp', 'rtsp', 'rtspu', 'sip', 'https', 'shttp', 'rtsp', 'rtspu', 'sip',
'mms', ''] 'mms', ''])
uses_query = ['http', 'wais', 'imap', 'https', 'shttp', 'mms', uses_query = set(['http', 'wais', 'imap', 'https', 'shttp', 'mms',
'gopher', 'rtsp', 'rtspu', 'sip', ''] 'gopher', 'rtsp', 'rtspu', 'sip', ''])
uses_fragment = ['ftp', 'hdl', 'http', 'gopher', 'news', uses_fragment = set(['ftp', 'hdl', 'http', 'gopher', 'news',
'nntp', 'wais', 'https', 'shttp', 'snews', 'nntp', 'wais', 'https', 'shttp', 'snews',
'file', 'prospero', ''] 'file', 'prospero', ''])
# Characters valid in scheme names # Characters valid in scheme names
scheme_chars = ('abcdefghijklmnopqrstuvwxyz' scheme_chars = ('abcdefghijklmnopqrstuvwxyz'