title: After using property decorator, python object has two very similar attributes (foo.bar and foo._bar). Is that ok?
body: <p>So I'm refactoring my code to be more Pythonic - specifically I've learned that using explicit getters and setters should be replaced with @property. My case is that i have an <code>Example</code> class with initialized <code>bar</code> attribute (initialization helps me to know that user set the <code>bar</code>):</p>
  <pre><code>class Example:
    def __init__(self):
      self.bar = 'initializedValue'
  
    @property
    def bar(self):
      return self._bar
  
    @bar.setter
    def bar(self, b):
      self._bar = b
  
    def doIfBarWasSet():
      if self.bar != 'initializedValue':
        pass
      else:
        pass
  </code></pre>
  <p>after running <code>foo = Example()</code> my debugger shows that foo has two attributes: <code>_bar</code> and <code>bar</code>, both set to <code>'initializedValue'</code>. Also, when I run <code>foo.bar = 'changedValue'</code> or <code>foo._bar = 'changedValue'</code>, both of them are changed to <code>'changedValue'</code>. Why there are two attributes? Isn't that redundant? I think I understand why there is <code>_bar</code> attribute - I added it in <code>@bar.setter</code>, but why there is <code>bar</code> as an string attribute? Shouldn't <code>bar</code> be rather a method leading to <code>bar</code> <code>@property</code>?</p>