My python annoyances so far

Bruno Desthuilliers bruno.42.desthuilliers at wtf.websiteburo.oops.com
Fri Apr 27 06:07:39 EDT 2007


flifus at gmail.com a écrit :
(snip)
> 
> Well, why do some things in the library have to be functions, and
> other things have to be class methods?
 > Why aren't they all just either functions or class methods? like
 > perhaps ruby.
 >

If I tell you that Python's functions are in fact static methods of 
their module, will this make you happy ? Because, while not technically 
true, this is conceptually equivalent.

Or if you prefer to stick to technical truth, python's methods are 
nothing more than a thin decorator around a function object (yes, 
Python's functions *are* objects) - so in fact, there are *only* 
functions - sometimes wrapped into a method object, sometimes not, 
depending on how you access them.

In both cases, the fact that you don't have enough knowledge of a 
language to understand it's design, and/or the fact that this design is 
different from other one you already know, doesn't by itself make this 
design an "annoyance".





More information about the Python-list mailing list