Sample code converted from Ruby to Python: Ruby Code: class Point attr_accessor :x,y def initialize(x = 0, y = 0) @x , @y = x, y end def to_s str = "" if(@x < 0) str += "a value in is too small" elsif(@x > -1 && @y > -1) str += "x = " + @x.to_s + " y = " + @y.to_s else str = " + self.to_s + " >" end end mypoint = Point.new(); Python Code: class Point: def __init__(self, x = 0, y = 0): self.x , self.y = x, y def __str__(self): if (self.x < 0) : s = "a value in is too small" elif (self.x > -1 and self.y > -1): s = "x = " + str(self.x) + " y = " + str(self.y) else: s = "" return s mypoint = Point() # print str(mypoint)