[Python-ideas] More user-friendly version for string.translate()

Mikhail V mikhailwas at gmail.com
Tue Oct 25 22:29:13 EDT 2016


On 26 October 2016 at 03:40, Steven D'Aprano <steve at pearwood.info> wrote:

> in a "table.txt" file, and typing:
>
> {
> 123: 456,
> 124: 457,
> 125: 458,
> # two hundred more lines
> }
>
>
> in a "table.py" file? The difference is insignificant. And the Python
> version can be cleaned up:
>

Ok, you have opened my eyes here. Thank you,
you re good.

> [...]
>> Motivation is that those can be optimised for speed
>
> That's not a motivation. Why are you talking about "optimizing for
> speed" functions that we have not yet established are needed?
>
> That reminds me of a story I once heard of somebody who was driving
> across the desert in the US once. One of his passengers noticed the
> highway signs and said "Wait, aren't we going the wrong way?" The driver
> replied "Who cares, we're making fantastic time!"
>
> Optimizing a function you don't need is not an optimization. It is a
> waste of time.

Making good time is important indeed!
I need translate() which drops non-defined chars. Please :)
No optimisation, no new syntax. deal?

Mikhail


More information about the Python-ideas mailing list