Python: overloading the __getattr__ and properties, making __setattr__ work correctly
<p>Consider the following python code: </p>

<pre><code>class Foo(object):

    def __init__(self, value):
        self._value = value

    @property
    def value(self):
        return "value: {v}".format(v=self._value)

    @value.setter
    def value(self, value):
        self._value = value

class Bar(object):

    def __init__(self):
        self.foo = Foo('foo')

    def __getattr__(self, attr, *args, **kwargs):
        """
        Intercepts attribute calls, and if we don't have it, look at the
        webelement to see if it has the attribute.
        """

        # Check first to see if it looks like a method, if not then just return
        # the attribute the way it is.
        # Note: this has only been tested with variables, and methods.
        if not hasattr(getattr(self.foo, attr), '__call__'):
            return getattr(self.foo, attr)

        def callable(*args, **kwargs):
            '''
            Returns the method from the webelement module if found
            '''
            return getattr(self.foo, attr)(*args, **kwargs)
        return callable

&gt;&gt;&gt; b = Bar()
&gt;&gt;&gt; b.foo
&lt;__main__.Foo object at 0x819410&gt;
&gt;&gt;&gt; b.foo.value
'value: foo'
&gt;&gt;&gt; b.foo.value = '2'
&gt;&gt;&gt; b.foo.value
'value: 2'
&gt;&gt;&gt; b.value
'value: 2'
&gt;&gt;&gt; b.value = '3'
&gt;&gt;&gt; b.value
'3'
</code></pre>

<p>That last part, I want it to be 'value: 3' instead of '3' because now my property 'value' is now an attribute instead.</p>

<p>Is it possible, and if it is how would I would I do that. </p>
