Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

737
Vistas
Difference between instance attributes and class attributes?
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

The fundamental difference is that class attributes are shared by all instances of that class, while instance attributes are unique to each object created with that class. Thus, instance variables are for data unique to each object and class variables are for attributes that must be shared by all instances of that class.

  • Instance attributes are created using the syntax instance.attr or self.attr ( self is really a convention, it's just an identifier that refers to the instance itself). As has been said, they are local to that instance and therefore only accessible from one of them.

  • Class attributes are defined outside of any class methods, usually just below the documentation string. They can be referenced directly from the class and can also be referenced from any instance of the class. Common uses are to create an enumerated constant, as a control variable in a Singleton, to set default values for instance variables, to define constants, etc.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda