Style for modules with lots of constants

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Wed Nov 1 17:28:26 CET 2006


Neil Cerutti:
> scriptref = glk.fileref_create_by_prompt('Transcript+TextMode',
>    'WriteAppend', 0)

That "+" sign seems useless. A space looks enough to me. The functions
can accept case-agnostic strings and ignore spaces inside them.
Example:
('transcript textmode ', 'writeappend', 0)


> Parsing the combinable bitfield contants might be slowish, though.

I think you have to test if this is true for your situation. Management
of interned strings is probably fast enough (compared to the rest of
things done by the Python interpreter) for many purposes.

Bye,
bearophile




More information about the Python-list mailing list