Running super().__init__(value) where value is an @property
<p>I'm just trying to grok how exactly Python handles this behind the scenes.  So take this code snippet (from Effective Python by Brett Slatkin):</p>

<pre><code>class Resistor(object):
    def __init__(self, ohms):
        self.ohms = ohms
        self.voltage = 0
        self.current = 0


class VoltageResistor(Resistor):
    def __init__(self, ohms):
        super().__init__(ohms)
        self._voltage = 0

    @property
    def ohms(self):
        return self._ohms

    @ohms.setter
    def ohms(self, ohms):
        if ohms &lt;= 0:
            raise ValueError('{o} ohms must be &gt; 0'.format(o=ohms))
        self._ohms = ohms

    @property
    def voltage(self):
        return self._voltage

    @voltage.setter
    def voltage(self, voltage):
        self._voltage = voltage
        self.current = self._voltage / self.ohms

VoltageResistor(-1) # fails
</code></pre>

<p>Running the <code>super()</code> call invokes the property check so that you can't instantiate with a zero or negative value.  What is confusing me to me is that I would think that since the the <code>__init__(ohms)</code> call is being ran on the superclass, shouldn't it be in a different scope (the scope of the superclass) and thus exempt from invoking the <code>@property</code> check?  </p>

<p>To supplement the above excellent answer, just add the following line in the parent's constructor to get a better idea of what is going on:</p>

<pre><code>class Resistor(object):
    def __init__(self, ohms):
        print (type(self).__name__)
        self.ohms = ohms
</code></pre>

<p>It will print <code>VoltageResistor</code> and then throw a <code>ValueError</code>. The <a href="https://docs.python.org/3/library/functions.html" rel="nofollow">Python docs</a> confirm this:</p>

<blockquote>
  <p>If <strong>c is an instance of C</strong>, c.x will invoke the getter, <strong>c.x = value will invoke the setter</strong> and del c.x the deleter.</p>
</blockquote>

python