teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

2

修正

2020/06/22 05:41

投稿

LouiS0616
LouiS0616

スコア35678

answer CHANGED
@@ -12,14 +12,23 @@
12
12
  Python 3.8.3
13
13
 
14
14
  >type hashtest.py
15
+ for _ in range(3):
15
- print(hash('spam'))
16
+ print(hash('spam'))
16
17
 
17
18
  >python hashtest.py
18
- -7703008444472350514
19
+ -738151039978978926
20
+ -738151039978978926
21
+ -738151039978978926
22
+
19
23
  >python hashtest.py
20
- -5563349027536334674
24
+ 347061199509584100
25
+ 347061199509584100
26
+ 347061199509584100
27
+
21
28
  >python hashtest.py
22
- 7568140066803560484
29
+ 8544783028387532850
30
+ 8544783028387532850
31
+ 8544783028387532850
23
32
  ```
24
33
 
25
34
  > バージョン 3.3 で変更: ハッシュのランダム化がデフォルトで有効になりました。

1

追記

2020/06/22 05:41

投稿

LouiS0616
LouiS0616

スコア35678

answer CHANGED
@@ -4,6 +4,24 @@
4
4
  print(hash('spam'))
5
5
  ```
6
6
 
7
+ 手元の実行環境では、値が変わることを確認できました。
8
+ ```cmd
9
+ >ver
10
+ Microsoft Windows [Version 10.0.18363.900]
11
+ >python --version
12
+ Python 3.8.3
13
+
14
+ >type hashtest.py
15
+ print(hash('spam'))
16
+
17
+ >python hashtest.py
18
+ -7703008444472350514
19
+ >python hashtest.py
20
+ -5563349027536334674
21
+ >python hashtest.py
22
+ 7568140066803560484
23
+ ```
24
+
7
25
  > バージョン 3.3 で変更: ハッシュのランダム化がデフォルトで有効になりました。
8
26
 
9
27
  [3. データモデル — Python 3.8.3 ドキュメント](https://docs.python.org/ja/3/reference/datamodel.html#object.__hash__)