title: How to create classes on Python?
body: <p>I'm learning the basics of python on classes and objects.</p>
  
  <p>I have created a basic class object with getters, setters and <code>__str__</code> function.</p>
  
  <pre><code>'''
  Created on 02/06/2012
  
  @author: rafael
  '''
  
  class Alumno(object):
      '''
      Esta clase representa a un alumno de la ibero
      '''
      __nombre=None
      __idAlumno=None
      __semestre=0
  
      def __init__(self,nombre,idAlumno,semestre):
          '''
          Constructor
          '''
          self.__nombre=nombre
          self.__idAlumno=idAlumno
          self.__semestre=semestre
  
      def Alumno(self):
          return self
  
      def getId(self):
          return self.__idAlumno
      def setId(self,idAlumno):
          self.__idAlumno=idAlumno
      def getNombre(self):
          return self.__nombre
      def setNombre(self,nombre):
          self.__nombre=nombre
      def getSemestre(self):
          return self.__semestre
      def setSemestre(self,semestre):
          self.__semestre=semestre
  
      def __str__(self):
          info= "Alumno: "+self.getNombre()+" - id: "+self.getId()+" - Semestre:"+str(self.getSemestre())
          return info
  </code></pre>
  
  <p>And a python module that imports that class and initialize the object for print their info.</p>
  
  <pre><code>'''
  Created on 02/06/2012
  
  @author: rafael
  '''
  from classes import *
  
  if __name__ == '__main__':
      alumno=Alumno("Juanito Perez","1234",2)
      print alumno
  </code></pre>
  
  <p>But I'm having a NameError Exception, so I must create my object in this way:</p>
  
  <pre><code>alumno=Alumno.Alumno(param,param,param)
  </code></pre>
  
  <p>But I want to be on this way:</p>
  
  <pre><code>alumno=Alumno(param,param,param)
  </code></pre>
  
  <p>Can someone explain to me how classes work or what I'm doing wrong?</p>