what does "()" syntax mean in python
<p>I am learning Exception Handling in python and came across following code snippet : an exception class:</p>

<pre><code>from flask import jsonify

class InvalidUsage(Exception):
    status_code = 400

    def __init__(self, message, status_code=None, payload=None):
        Exception.__init__(self)
        self.message = message
        if status_code is not None:
            self.status_code = status_code
        self.payload = payload

    def to_dict(self):
        rv = dict(self.payload or ())
        rv['message'] = self.message
        return rv
</code></pre>

<p>In this code, what does this line actually mean</p>

<pre><code>rv = dict(self.payload or ())
</code></pre>

<p>inside <code>to_dict</code> method? What does <code>()</code> stand for?</p>

<p><code>()</code> stands for an empty tuple. On the other hand, <code>or</code> here acts like <a href="https://en.wikipedia.org/wiki/Null_coalescing_operator" rel="nofollow">null coalescing operator</a> in <code>self.payload or ()</code> where the entire expression returns an empty tuple if <code>self.payload</code> evaluates to false.</p>

<pre><code>&gt;&gt;&gt; False or 5
5
&gt;&gt;&gt; [] or (1, 2, 3)
(1, 2, 3)
</code></pre>

python