1 | #!/usr/bin/env bash
|
2 | #
|
3 | # Usage:
|
4 | # ./python-language.sh <function name>
|
5 |
|
6 | set -o nounset
|
7 | set -o pipefail
|
8 | set -o errexit
|
9 |
|
10 | # https://stackoverflow.com/questions/11181519/python-whats-the-difference-between-builtin-and-builtins
|
11 | # Hm there was a lot of renaming that happened in Python 2 and 3. This isn't
|
12 | # the best comparison.
|
13 |
|
14 | dump-builtins() {
|
15 | local py=$1
|
16 | $py -c '
|
17 | for name in sorted(dir(__builtins__)):
|
18 | print(name)
|
19 | ' | sort > _tmp/$py.txt
|
20 | }
|
21 |
|
22 | # Hm Python 3 moved sorted(), etc. out of __builtins__?
|
23 | builtins() {
|
24 | dump-builtins python
|
25 | dump-builtins python3
|
26 |
|
27 | comm _tmp/{python,python3}.txt || true
|
28 | wc -l _tmp/{python,python3}.txt
|
29 | }
|
30 |
|
31 | "$@"
|