[Python-ideas] float('∞')=float('inf')

Joshua Landau joshua at landau.ws
Sun Jul 14 11:46:57 CEST 2013


On 14 July 2013 10:17, Steven D'Aprano <steve at pearwood.info> wrote:
> On 14/07/13 16:40, Joshua Landau wrote:
>>
>> Personally, code in which copy-paste is the best way to
>> write single-character identifiers is a hassle. I know because I
>> wrote:
>
> Copy-pasting is never the best way to write single-character identifiers,
> however it may be the least-worst way when dealing with unfamiliar
> characters or those not supported by your input system. It works, even in
> Notepad. But nobody suggests Notepad is the best way to edit code.
> Professionals use a more powerful editor with lots of powerful shortcuts.
> Professionals who need to support non-ASCII characters should likewise
> choose an editor that provides them with powerful character entry methods
> that are faster than copy-and-pasting.

How do you input unicode then? I don't count typing escape sequences
better, because I don't want to memorise pseudorandom numbers.

That said, you have inspired me to find a new plugin for my editor
which makes unicode input much easier (\forall for example), so
thanks.

> We have developers here who have seemingly memorized seemingly vast numbers
> of Emacs and Vim key sequences to perform the most obscure functions, and
> yet are apparently utterly terrified of the idea that some time in the
> future they may have to memorize a key sequence like option-p to get π, or
> option-u o to get ö. (See, I still remember them, 15+ years since I last
> used a Mac extensively. Well-thought out mnemonic key sequences for the
> win.)

The ones I added manually to that were actually single-key shortcuts
(ALT-GR <key>); the others were much harder in that they weren't.
There's no simple way to usefully fit so many thousands of
possibilities into such a small keyboard, in my opinion without
reverting to character codes.

> Editor support for non-ASCII characters ranges from mediocre to absolutely
> atrocious, depending on the characters and the editor. I don't deny this. A
> softly, softly approach to non-ASCII identifiers is still wise. I'm still
> unconvinced that Python 3.4 should accept ∞ in the language, and I am
> probably one of the minority who would actually made use of such a feature.
> But let's please put aside the concept that writing code in anything other
> than a subset of American English characters is by definition an insane
> thing to do.

I didn't say it was insane. But I do dislike it. Code should be quick
for the majority of people (of the same language) to edit; unicode
symbols ruin that barrier. This includes Notepad users. Should I be
French, "á" would be completely acceptable -- if you cannot type that
as a French human, you're doing something wrong. But expecting typical
read-writers of your program to have better access to unicode infinity
(which I wrote like that because copy-paste is a hassle) than
copy-paste is presumptuous and silly. There is a *lot* of unicode, and
it is hard to get at its reaches.


More information about the Python-ideas mailing list