classes and functions

Thomas Dybdahl Ahle lobais at gmail.com
Sat Mar 3 00:56:23 CET 2007


Den Fri, 02 Mar 2007 19:26:08 -0300 skrev Silver Rock:

> Friends,
> 
> I don´t see why using classes.. functions does everything already. I
> read the Rossum tutotial and two other already.
> 
> Maybe this is because I am only writing small scripts, or some more
> serious misunderstandings of the language.
> 
> Please give me a light.

I guess you are fimiliar with the string methods. You can do stuff like 
"hi hi".split(" ") or "  hi".strip().
This is because a string is a class.
The same functionality could be done by functions:
split("hi hi", " ") and strip("  hi")
but it feals more inituitive to put the dot after the variable.
It also makes it easier to know where to look for functions related to 
the object.

And yes, I'm sure you will see the light, when doing larger programs :) 
Don't worry.



More information about the Python-list mailing list