[compat] Use try except for compat_numeric_types
[youtube-dl] / youtube_dl / compat.py
index 7189020192601c289f47eafbda40feefd14cde6c..0c119e417ce86174a7b21a9639f160a17a3263a3 100644 (file)
@@ -2760,6 +2760,12 @@ else:
     compat_kwargs = lambda kwargs: kwargs
 
 
+try:
+    compat_numeric_types = (int, float, long, complex)
+except NameError:  # Python 3
+    compat_numeric_types = (int, float, complex)
+
+
 if sys.version_info < (2, 7):
     def compat_socket_create_connection(address, timeout, source_address=None):
         host, port = address
@@ -2895,6 +2901,7 @@ __all__ = [
     'compat_input',
     'compat_itertools_count',
     'compat_kwargs',
+    'compat_numeric_types',
     'compat_ord',
     'compat_os_name',
     'compat_parse_qs',