[EMAIL PROTECTED] wrote: >> Well, why do some things in the library have to be functions, and >> other things have to be class methods? >> Perhaps because some things are more naturally function like? For 'instance' (pardon the pun), functions shouldn't retain data. They perform an operation, return data and quit. While retaining data is a feature of an class/instance.
If I'm looking up the time of day in L.A., why do I need the whole clock database of times including New York and London? Another example are with respect to 'int' and 'float' operations. Why should int(x) be a class? Did you want to save and operate on the value of x again? No, you want the integer portion of x. Ditto float(x); somebody input '5' but you want it clear it 5.0. You typecast it your way. But the float operation doesn't need to retain the last input, nor even exist after it's last use. So, without have any current values referenced inside 'float', garbage collection can recover the memory space of 'float'. And before someone get's all technical, I know everything in Python is an 'object' even None, which implies class, or is it the other way around? sph -- http://mail.python.org/mailman/listinfo/python-list