Style for modules with lots of constants

Neil Cerutti horpner at yahoo.com
Wed Nov 1 11:46:17 EST 2006


On 2006-11-01, bearophileHUGS at lycos.com <bearophileHUGS at lycos.com> wrote:
> 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)

That's pretty cool. Not as pretty, but easier for users,
possibly.

>> 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.

Agreed. I meant I'd have to later test if it's were fast enough.

-- 
Neil Cerutti



More information about the Python-list mailing list