]> granicus.if.org Git - python/commitdiff
Use sets instead of lists for membership testing
authorRaymond Hettinger <python@rcn.com>
Thu, 6 May 2004 16:55:07 +0000 (16:55 +0000)
committerRaymond Hettinger <python@rcn.com>
Thu, 6 May 2004 16:55:07 +0000 (16:55 +0000)
Lib/urlparse.py

index 2f1965aca7d9687678bfca09e0d7d9b3e1aac694..f6b367fc9e12fb51899092b691cd5f2fc0748420 100644 (file)
@@ -8,22 +8,22 @@ __all__ = ["urlparse", "urlunparse", "urljoin", "urldefrag",
            "urlsplit", "urlunsplit"]
 
 # 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',
-                               'prospero', 'rtsp', 'rtspu', '']
-uses_netloc = ['ftp', 'http', 'gopher', 'nntp', 'telnet',
+                               'prospero', 'rtsp', 'rtspu', ''])
+uses_netloc = set(['ftp', 'http', 'gopher', 'nntp', 'telnet',
                              'imap', 'wais', 'file', 'mms', 'https', 'shttp',
-                             'snews', 'prospero', 'rtsp', 'rtspu', '']
-non_hierarchical = ['gopher', 'hdl', 'mailto', 'news',
-                                  'telnet', 'wais', 'imap', 'snews', 'sip']
-uses_params = ['ftp', 'hdl', 'prospero', 'http', 'imap',
+                             'snews', 'prospero', 'rtsp', 'rtspu', ''])
+non_hierarchical = set(['gopher', 'hdl', 'mailto', 'news',
+                                  'telnet', 'wais', 'imap', 'snews', 'sip'])
+uses_params = set(['ftp', 'hdl', 'prospero', 'http', 'imap',
                              'https', 'shttp', 'rtsp', 'rtspu', 'sip',
-                             'mms', '']
-uses_query = ['http', 'wais', 'imap', 'https', 'shttp', 'mms',
-                            'gopher', 'rtsp', 'rtspu', 'sip', '']
-uses_fragment = ['ftp', 'hdl', 'http', 'gopher', 'news',
+                             'mms', ''])
+uses_query = set(['http', 'wais', 'imap', 'https', 'shttp', 'mms',
+                            'gopher', 'rtsp', 'rtspu', 'sip', ''])
+uses_fragment = set(['ftp', 'hdl', 'http', 'gopher', 'news',
                                'nntp', 'wais', 'https', 'shttp', 'snews',
-                               'file', 'prospero', '']
+                               'file', 'prospero', ''])
 
 # Characters valid in scheme names
 scheme_chars = ('abcdefghijklmnopqrstuvwxyz'