Style for modules with lots of constants

Ben Finney bignose+hates-spam at benfinney.id.au
Wed Nov 1 17:40:42 EST 2006


Neil Cerutti <horpner at yahoo.com> writes:

> Calls to Glk functions are thus ugly and tedious.
>
>     scriptref = glk.fileref_create_by_prompt(
>             glk.fileusage_Transcript | glk.fileusage_TextMode,
>             glk.filemode_WriteAppend, 0)
>
> Please give me some good style advice for this situation.

One thing that has been implicit in other replies is the naming
convention for constants. There's nothing stopping a user from
re-binding a name in Python, so we use the convention that constants
are named with UPPER_CASE to indicate they shouldn't be re-bound.

-- 
 \       "Everything you read in newspapers is absolutely true, except |
  `\        for that rare story of which you happen to have first-hand |
_o__)                                      knowledge."  -- Erwin Knoll |
Ben Finney




More information about the Python-list mailing list