Terry Reedy <[EMAIL PROTECTED]> wrote:

> The lookup table is a constant.  If made a tuple, it will be compiled as 
> a constant (as least in 2.6, maybe 2.5).  

Force of habit.  I tend to work on lists by indexing and/or iterating,
and on tuples by destructuring, and choose types based on the kinds of
things I'll be doing.  But I did intentionally ensure that the tables
were constant so that readers could apply the obvious optimization if
they wanted.  (Also, unnecessarily computing str(i) seemed bad.)

> In any case, it could (and to me should) be lifted out of the string
> comp.

For performance, yes.  But doing a modexp is going to kill performance
anyway, so I decided to save screen lines.  After all, applying even
fairly basic number theory to a problem like this isn't really what one
might call a readable solution. ;-)

-- [mdw]
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to