How to implement a Required Property in Python
<p>If I have a class such as below (only with many more properties), is there are clean way to note which fields are required before calling a particular method?</p>

<pre><code>class Example():

    def __init__(self):
        pass

    @property
    """Have to use property methods to have docstrings..."""
    def prop1(self):
        return self._prop1
    @prop1.setter
    def task(self, value):
        # validation logic..
        self._prop1 = value

    def method(self):
        # check all required properties have been added
</code></pre>

<p>I could write an array by hand of all required propeties and loop through them in a method, but I was wondering if there is a cleaner way for example by implementing a @requiredProperty descriptor. </p>

<p>The class is used to generate a POST request for a web API. The request has 25+ parameters, some of which are required and some optional. </p>

<p>Rather than on the method calling the request having to loop through an array such as:</p>

<pre><code>required_props = ['prop1','prop2',....]
</code></pre>

<p>I was hoping there was a way in Python of adding a required decorator to properties so I wouldn't have to keep track by hand. E.g.</p>

<pre><code>    @property, @required
    def prop1(self):
        return self._prop1
</code></pre>
