[Baypiggies] Code/Idea Review (WARNING: SPOILER)
Dennis Reinhardt
DennisR at dair.com
Sun Dec 16 02:32:28 CET 2007
At 04:20 PM 12/15/2007, Glen Jarvis wrote:
>-- Issue #3 --
>Whether to use a hard-coded string or not. T
>
> trans_table = string.maketrans (
> "abcdefghijklmnopqrstuvwxyz",
> "cdefghijklmnopqrstuvwxyzab",
> )
>
>So, This issue is probably one that will start discussion. When would
>we use this style and when would we not? This would have been simpler
>for this particular task. But, what over-all 'rule' can one follow?
I use this style for real-world permutation. I did not invent it in
response to your posting. Rather, I think this is the style you would use
coding a real permutation. It is very limiting to define the translate
table algorithmically. Using the above form, one can drag and drop to
scramble the second line.
This style is also very handy for permuting hex:
"0123456789abcdef",
"d27b3601a9f45ce8"
something, I can put together with a few mouse drag and drops. By
construction, it is easy to know that each character is used once and only
once. When constructing synthetic strings via indexes, it is always a
nagging mystery whether any character gets included twice or not at all.
I would imagine that using this style for a 65K Unicode string is not
practical so that would be a don't use case.
regards, Dennis
---------------------------------
| Dennis | DennisR at dair.com |
| Reinhardt | http://www.dair.com |
---------------------------------
More information about the Baypiggies
mailing list