B
beliavsky
I am reading about object-oriented programming in "Learning Python",
2nd. ed. by Lutz and Ascher. On p299, they write
"... most of the OOP story in Python boils down to the expression
object.attribute. [...] In fact, when classes are involved, the Python
expression above translates to the following in natural language:
'Find the first occurrence of attribute by looking in an object, and
all classes above it, from bottom to top and left to right'"
It seems to me that doing this in a scripting language, at run-time,
could be slow, compared to an equivalent code not using classes. How
fast is Python OO code compared to non-OO code?
I know that object-oriented numerical code in C++ can be much slower
than the procedural C or Fortran equivalent, unless one is careful. To
what extent is this true with OO and non-OO Python?
2nd. ed. by Lutz and Ascher. On p299, they write
"... most of the OOP story in Python boils down to the expression
object.attribute. [...] In fact, when classes are involved, the Python
expression above translates to the following in natural language:
'Find the first occurrence of attribute by looking in an object, and
all classes above it, from bottom to top and left to right'"
It seems to me that doing this in a scripting language, at run-time,
could be slow, compared to an equivalent code not using classes. How
fast is Python OO code compared to non-OO code?
I know that object-oriented numerical code in C++ can be much slower
than the procedural C or Fortran equivalent, unless one is careful. To
what extent is this true with OO and non-OO Python?