Non-logical operator usage of or in python

There was a description method I didn't know about in the code of s3 target of spotify / luigi.

        self.fs = client or S3Client()

It seems that this or is not a logical operator that is generally used in conditional expressions. The left side has priority, and when the left side is None, the right side is entered.

[Python or can be used for other than conditional branching](http://momijiame.tumblr.com/post/29966747567/python-%E3%81%AE-or-%E3%81%AF%E6%9D%A1 % E4% BB% B6% E5% 88% 86% E5% B2% 90% E4% BB% A5% E5% A4% 96% E3% 81% AB% E3% 82% 82% E4% BD% BF% E3 % 81% 88% E3% 82% 8B)

Recommended Posts

Non-logical operator usage of or in python
Usage of Python locals ()
[Python] Correct usage of map
Equivalence of objects in Python
Python bitwise operator and OR
Sample usage of Python pickle
Basic usage of Python f-string
Implementation of quicksort in Python
[Python] Correct usage of join
Python or and and operator trap
Pixel manipulation of images in Python
Division of timedelta in Python 2.7 series
MySQL-automatic escape of parameters in python
Handling of JSON files in Python
Implementation of life game in Python
Waveform display of audio in Python
Elementary ITK usage learned in Python
Create a Kubernetes Operator in Python
Law of large numbers in python
Implementation of original sorting in Python
Reversible scrambling of integers in Python
Python in is also an operator
[Python] Basic pattern and usage of if statement (comparison operator and Boolean operator)
Conversion of string <-> date (date, datetime) in Python
Check the behavior of destructor in Python
General Theory of Relativity in Python: Introduction
Output tree structure of files in Python
Display a list of alphabets in Python 3
Comparison of Japanese conversion module in Python3
OR the List in Python (zip function)
Summary of various for statements in Python
Connect a lot of Python or and and
Referencing INI files in Python or Ruby
The result of installing python in Anaconda
When looking at memory usage in Python 3
Gang of Four (GoF) Patterns in Python
The basics of running NoxPlayer in Python
Project Euler # 16 "Sum of Powers" in Python
Traffic Safety-kun: Recognition of traffic signs in Python
Summary of built-in methods in Python list
In search of the fastest FizzBuzz in Python
Practical example of Hexagonal Architecture in Python
Project Euler # 17 "Number of Characters" in Python
Double pendulum equation of motion in python
Get rid of DICOM images in Python
Status of each Python processing system in 2020
Project Euler # 1 "Multiples of 3 and 5" in Python
Meaning of using DI framework in Python
[Scientific / technical calculation by Python] Calculation of matrix product by @ operator, python3.5 or later, numpy
How to format a list of dictionaries (or instances) well in Python
Quadtree in Python --2
Python in optimization
CURL in python
Metaprogramming in Python
Draw a graph of a quadratic function in Python
Python 3.3 in Anaconda
Geocoding in python
Introduction of Python
SendKeys in Python
[Python] Sort the list of pathlib.Path in natural sort
Receive websocket of kabu station ® API in Python