aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/language/python.rb
diff options
context:
space:
mode:
authorXu Cheng2016-08-05 22:01:32 +0800
committerGitHub2016-08-05 22:01:32 +0800
commita8566c9848122474b92fc8989eec196d5f4fb69b (patch)
tree896c040fb575962be0aeb27bc9a99454f3514d73 /Library/Homebrew/language/python.rb
parent38209aadbfe4fd0c6772467c4bc5c63325d53f6c (diff)
downloadbrew-a8566c9848122474b92fc8989eec196d5f4fb69b.tar.bz2
various: eliminate the usage of `any?` (#638)
`any?` is not the opposite of `empty?`. Besides the case that `[false, nil].any?` will return false, `any?`(O(n)) has much worse performance than `empty?`(O(1)).
Diffstat (limited to 'Library/Homebrew/language/python.rb')
-rw-r--r--Library/Homebrew/language/python.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/Library/Homebrew/language/python.rb b/Library/Homebrew/language/python.rb
index 68e6f86ca..eb0675638 100644
--- a/Library/Homebrew/language/python.rb
+++ b/Library/Homebrew/language/python.rb
@@ -131,8 +131,8 @@ module Language
dep_site_packages = Formula[d.name].opt_lib/"python#{xy}/site-packages"
next unless dep_site_packages.exist?
"import site; site.addsitedir('#{dep_site_packages}')\n"
- end
- if pth_contents.any?
+ end.compact
+ unless pth_contents.empty?
(venv_root/"lib/python#{xy}/site-packages/homebrew_deps.pth").write pth_contents.join
end