Skip to content

Instantly share code, notes, and snippets.

@nnashiki
Last active August 10, 2018 05:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nnashiki/2cce50f1c4237891b0cfa8af0533a70f to your computer and use it in GitHub Desktop.
Save nnashiki/2cce50f1c4237891b0cfa8af0533a70f to your computer and use it in GitHub Desktop.
a or b or c 代入の順序
$ python -S
Python 3.7.0 (default, Jun 29 2018, 20:13:13) 
[Clang 9.1.0 (clang-902.0.39.2)] on darwin
>>> a=1
>>> b=2
>>> c=3
>>> print(a or b or c)
1
$ python -S
Python 3.7.0 (default, Jun 29 2018, 20:13:13) 
[Clang 9.1.0 (clang-902.0.39.2)] on darwin
>>> a=''
>>> b=2
>>> c=3
>>> print(a or b or c)
2
$ python -S
Python 3.7.0 (default, Jun 29 2018, 20:13:13) 
[Clang 9.1.0 (clang-902.0.39.2)] on darwin
>>> a=None
>>> b=2
>>> c=3
>>> print(a or b or c)
2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment