[Python-3000] iostack and Oh Oh

Baptiste Carvello baptiste13 at altern.org
Thu Dec 7 22:34:59 CET 2006


Tim Hochberg a écrit :
> 
> Here goes: to the extent that the semantics aren't clear from the 
> methods it is sufficient, and preferable, to attach the semantic 
> information to the methods rather their associated class.
> 
which imho is the whole of the question: which level of granularity is desirable 
for defining semantics?

If the granularity is in too big chunks, it will get in the way of the user the 
same way isinstance() would. If it is too small, lots of time and energy will be 
waisted in defining contracts that nobody relies on (plus said contracts might 
well be inconsistent if they don't have actual users).

Imho finding this right level of granularity is part of the design of an API, 
and can only be decided be a human on a case by case basis. There is no silver 
bullet here: sometimes methods are the right level of granularity, sometimes 
classes, sometimes inbetween.

Thus the language should be neutral on that point.

Cheers,
BC



More information about the Python-3000 mailing list