[Python-es] POO

Arnau Sanchez pyarnau en gmail.com
Jue Jul 29 15:46:31 CEST 2010


Buenas,

No conozco en detalle la implementación OOP de Python, pero en la
Wikipedia he encontrado un párrafo que explicaría por qué algunos veis
galgos y otros podencos:

"In most languages, the structures as defined by the class determine how
the memory used by its instances will be laid out. This technique is
known as the cookie-cutter model. The alternative to the cookie-cutter
model is the model of Python, wherein objects are structured as
associative key-value containers. In such models, objects that are
instances of the same class could contain different instance variables,
as state can be dynamically added to the object. This may resemble
prototype-based languages in some ways, but it is not equivalent"

http://en.wikipedia.org/wiki/Class_(programming)

Pero creo que, más que plantear una discusión teórica, sería interesante
mostrar ejemplos concretos, de forma que veamos en la práctica qué
implicaciones tiene la (al parecer particular) implementación OOP
de Python.


Más información sobre la lista de distribución Python-es