Dreaming of new generation IDE

Steven D'Aprano steven at REMOVE.THIS.cybersource.com.au
Wed Feb 3 19:01:06 EST 2010


On Wed, 03 Feb 2010 16:38:21 -0600, Robert Kern wrote:

>>> class.method(name, count)
>>
>> Obviously? I don't know about that. Being told that "count" is an int
>> doesn't really help me -- it's obvious just from the name. In a well-
>> written API, what else could it be?
> 
> A bool. As in telling the method whether or not it should count
> something.

Ha ha, good point. I question that this is a well-written API: such flags 
to change the behaviour of a function/method are generally poor design. 
If method behaves differently depending on whether or not you want it to 
count something, then it is usually better design to have two methods, 
one that counts and one that doesn't.

In any case, yes, the weakness of naming conventions is that there are 
always odd-corner cases of natural language. Perhaps `name` is also a 
flag telling the method whether or not to name something.

But then, one can write crappy APIs in any language.



-- 
Steven



More information about the Python-list mailing list