Named constants -- no such thing as "too obvious"

Asun Friere afriere at yahoo.co.uk
Mon Jun 2 01:22:01 EDT 2003


Ben Finney <bignose-hates-spam at and-zip-does-too.com.au> wrote in message news:<slrnbdl2l3.h32.bignose-hates-spam at iris.polar.local>...
> What if the code has to deal with several other "obvious" constants,
> that just happen to have the value 24?  How will the reader know which
> instance of 24 is HOURS_PER_DAY and which is BEERS_PER_SLAB?  If you
> don't write it so, then they're guessing -- and when reading code,
> especially when trying to debug it at the same time, guesswork is to be
> avoided as much as possible.

Look I don't want to take issue with anything you've said, but wouldn't
TINNIES_PER_SLAB be the more 'obvious' name? ;)




More information about the Python-list mailing list