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

回答編集履歴

1

修正

2018/05/09 04:38

投稿

LouiS0616
LouiS0616

スコア35678

answer CHANGED
@@ -10,10 +10,11 @@
10
10
  if event:
11
11
  image_mode = Mode.gray
12
12
 
13
- if image_mode == Mode.gray:
13
+ if image_mode is Mode.gray:
14
14
  print('hoge')
15
15
  ```
16
16
 
17
+ **修正:** 比較をisに変更。[列挙型メンバーは同一性を比較できます](https://docs.python.jp/3/library/enum.html#comparisons)
17
- [Wandbox](https://wandbox.org/permlink/pPUtIIjRqSIi5zTZ)
18
+ [Wandbox](https://wandbox.org/permlink/LicW0bwAaDy3nmnH)
18
19
 
19
20
  文字列よりは用途が明確でわかりやすいかと。