From 2ca3de9fc7606f2b8483b1edea31aaba6bf3782c Mon Sep 17 00:00:00 2001 From: Philipp Moritz Date: Tue, 3 Jul 2018 16:51:26 -0700 Subject: [PATCH] clarify comment --- python/pyarrow/compat.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/python/pyarrow/compat.py b/python/pyarrow/compat.py index 03af73a67f90c..1fcaf4c59c477 100644 --- a/python/pyarrow/compat.py +++ b/python/pyarrow/compat.py @@ -176,11 +176,14 @@ def import_tensorflow_extension(): tensorflow_loaded = False # Try to load the tensorflow extension directly - # (this is much faster than importing tensorflow) + # This is a performance optimization, tensorflow will always be + # loaded via the "import tensorflow" statement below if this + # doesn't succeed. try: site_paths = site.getsitepackages() + [site.getusersitepackages()] except AttributeError: - # Workaround for https://github.com/pypa/virtualenv/issues/228 + # Workaround for https://github.com/pypa/virtualenv/issues/228, + # this happends in some configurations of virtualenv site_paths = [os.path.dirname(site.__file__) + '/site-packages'] for site_path in site_paths: ext = os.path.join(site_path, "tensorflow", @@ -191,7 +194,7 @@ def import_tensorflow_extension(): tensorflow_loaded = True break - # If this failed, try to load tensorflow the normal ways + # If the above failed, try to load tensorflow the normal way # (this is more expensive) if not tensorflow_loaded: try: