On Jan 17, 2005, at 23:07, Bernard Lebel wrote:

Okay... so if I follow you, a class that has methods not part of itself, it's not a static class...? So should I understand that a class that gets inherited methods can be considered OOP?

Not exactly. Basically, object-oriented programming is just that; that is, working with objects, which are instances of classes.
Now, class methods/attributes, which I call "static" because that's the C++/Java keyword that triggers them, are methods and attributes that are shared by all the instances of that class, not specific to a particular instance. The class doesn't even have to be instanciated (no objects have to be created) for them to be used. They are effectively part of the class itself, hence the name, class methods (as opposed to instance methods).
A common use for class attributes is to keep track of how many times the class has been instanciated (number of objects created).


So, if my class only has static methods and attributes, any object I create with that class is empty: it has no attributes of its own, and is impossible to be interacted with. Thus, you could just as well say it doesn't exist, and that the class can't be used to create objects.
Therefore, you're using a class to do procedural programming.


However, the class has its separate namespace: when you're calling methods from that class from outside its body, the call syntax is Class.method(). Which is exactly the same thing as using a function from Python module.

        I hope that answers your question...

-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic creature of meat and bone, panting and sweating as you run through my corridors... How can you challenge a perfect, immortal machine?"


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to