On Thu, 26 Apr 2007 10:45:22 -0700, Steven Howe wrote: > [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.
Why ever not? How the function performs the operation is an implementation detail you shouldn't care about. Functions that cache the result of long time-consuming complications are _good_. You might also consider generators and iterators and co-routines. None of those could exist if functions couldn't store data. [snip] > Another example are with respect to 'int' and 'float' operations. Why > should int(x) be a class? That's a terrible example, because in fact int and float _are_ classes (actually types, which are conceptually the same as classes but implemented differently). -- Steven. -- http://mail.python.org/mailman/listinfo/python-list