title: why cant i replace __add__ with __radd__?
body: <p>I am (for exercise) trying to make a class that works with roman numerals. I am trying to put as much functionality into it as possible, so i looked into making operators work on them. I found (example, the problem persists among other pairs of methods) <code>__add__</code> and <code>__radd__</code>. The documentation says that if <code>__add__</code> is not defined it (or if it fails) looks into <code>__radd__</code>, but when i try to delete <code>__add__</code> and edit the <code>__radd__</code> method it works on <code>0 + myobject</code>, but not on <code>object1 + object2</code>.</p>
  
  <p>Here is the class (with a few things cut out because they're not important for my problem):</p>
  
  <pre><code>class Roman:
      num_map = [('M', 1000), ('CM', 900), ('D', 500), ('CD', 400), ('C', 100), ('XC', 90), ('L', 50), ('XL', 40), ('X', 10), ('IX', 9), ('V', 5), ('IV', 4), ('I', 1)]
  
      def __init__(self, num=None):
          self.decimal = 0
          self.roman = 'N'
          if type(num) == type(0):
              self.__setattr__('decimal', num)
          elif type(num) == type(''):
              self.__setattr__('roman', num)
  
  
      def __setattr__(self, field, value):
          if field == 'decimal' and type(value) == type(0):
              super().__setattr__('decimal', value)
              super().__setattr__('roman', self.dec2roman(value))
          elif field == 'roman' and type(value) == type(''):
              super().__setattr__('roman', value)
              super().__setattr__('decimal', self.roman2dec(value))
  </code></pre>
  
  <p>The methods <code>self.dec2roman(integer)</code> and <code>self.roman2dec(string)</code> simply convert from one format to the other.</p>
  
  <p>Now if i try to make <code>__radd__</code> like this:</p>
  
  <pre><code>def __radd__(self, other):
      if other == 0:
          return self
      return Roman(self.decimal + other.decimal)
  </code></pre>
  
  <p>it doesn't work, but this does:</p>
  
  <pre><code>def __add__(self,other):
      return Roman(self.decimal + other.decimal)
  def __radd__(self, other):
      if other == 0:
          return self
      return self + other
  </code></pre>
  
  <p>Here's the error i get:</p>
  
  <pre><code>&gt;&gt;&gt; from roman import Roman
  &gt;&gt;&gt; a = Roman(3)
  &gt;&gt;&gt; b = Roman('X')
  &gt;&gt;&gt; a + b
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  TypeError: unsupported operand type(s) for +: 'Roman' and 'Roman'
  </code></pre>
  
  <p>Does someone know what is going on?</p>