OO in Python? ^^

Matthias Kaeppler void at void.com
Sun Dec 11 04:02:31 EST 2005


Brian Beck wrote:
> def foo(self):
>     raise NotImplementedError("Subclasses must implement foo")

That's actually a good idea, though not as nice as a check at 
"compile-time" (jesus, I'm probably talking in C++ speech again, is 
there such a thing as compile-time in Python at all?!)

Another thing which is really bugging me about this whole dynamically 
typing thing is that it seems very error prone to me:

foo = "some string!"

# ...

if (something_fubar):
    fo = "another string"

Oops, the last 'o' slipped, now we have a different object and the 
interpreter will happily continue executing the flawed program.

I really see issues with this, can anyone comment on this who has been 
working with Python more than just a day (like me)?

Regards,
Matthias



More information about the Python-list mailing list