Clarity vs. code reuse/generality

Lie Ryan lie.1296 at gmail.com
Tue Jul 7 08:48:34 EDT 2009


Steven D'Aprano wrote:
> On Tue, 07 Jul 2009 05:13:28 +0000, Lie Ryan wrote:
> 
>> When people are fighting over things like `sense`, although sense may
>> not be strictly wrong dictionary-wise, it smells of something burning...
> 
> That would be my patience.
> 
> I can't believe the direction this discussion has taken.

Me neither.

> Anybody sensible 
> would be saying "Oh wow, I've just learned a new meaning to the word, 
> that's great, I'm now less ignorant than I was a minute ago". But oh no, 
> we mustn't use a standard meaning to a word, heaven forbid we disturb 
> people's ignorance by teaching them something new.

A meaning of a word is meaningless if nobody apart the writer
understands it. The purpose of code is 1) to communicate with the
computer, 2) to communicate with fellow programmer. The second point is
especially important if the code are written for pedantic purpose.
Teaching is largely one-way communication and often students that does
not understand about a slight point could not or would not communicate
their feelings because they think it is too silly. If the use of word is
criticized on a two-way communication channel (e.g. newsgroup), it
should raise a question of whether the word should be described first or
whether a synonym would be more suitable for the purpose. Most of these
do not apply on practical, non-pedantic purpose though, since in
non-pedantic settings you are expected to know and use the jargons
however (in)sensible they may be at first sight.

> It's as simple as this: using `sense` as a variable name to record the 
> sense of a function is not a code smell, any more than using `flag` to 
> record a flag would be, or `sign` to record the sign of an object.

Nobody said code smell... linguistic smell is more appropriate.

> If you 
> don't know the appropriate meanings of the words sense, flag or sign, 
> learn them, don't dumb down my language.



More information about the Python-list mailing list