Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #70535

Re: Unicode in Python

Newsgroups comp.lang.python
Date 2014-04-22 23:57 -0700
References <0f253434-5e7d-4eea-88e1-7997fec2bd2d@googlegroups.com> <mailman.9452.1398232238.18130.python-list@python.org>
Message-ID <773afa7d-4b6d-4d67-8d40-ea90b335a1a2@googlegroups.com> (permalink)
Subject Re: Unicode in Python
From Rustom Mody <rustompmody@gmail.com>

Show all headers | View raw


On Wednesday, April 23, 2014 11:22:33 AM UTC+5:30, Steven D'Aprano wrote:

> 25 Unicode characters down, 1114000+ to go :-)

The question would arise if there was some suggestion to add
1114000(+) characters to the syntactic/lexical definition of python.

IOW while its true that unicode is a character-set, its better to think
of it as a repertory  -- here is the universal set from which a choice is available.

On Wednesday, April 23, 2014 11:20:35 AM UTC+5:30, Chris Angelico wrote:
> On Wed, Apr 23, 2014 at 3:31 PM, Rustom Mody wrote:
> > Chris Angelico wrote:
> >> it's impossible for most people to type (and programming with a palette
> >> of arbitrary syntactic tokens isn't my idea of fun)...
> > Where's the suggestion to use a "palette of arbitrary tokens" ?
> > I just tried a greek keyboard; ie do
> > $ setxkbmap -option "grp:switch,grp:alt_shift_toggle,grp_led:scroll" -layout "us,gr"
> > Thereafter typing
> > abcdefghijklmnopqrstuvwxyz
> > after a Shift-Alt
> > gives
> > αβψδεφγηιξκλμνοπ;ρστθωςχυζ
> > One more Shift-Alt and back to roman

> Okay. Now what about your other symbols? Your alternative assignment
> operator, for instance. How do you type that?

In case you missed it, I said:

> Of course
> - One would need to define such a keyboard (setxkb)
> - One would have to find similar technologies for other OSes

In more detail:
In our normal use of a US-104 keyboard, every letter 'costs' something.
eg 'a' costs 1 keystroke
   'A' costs 2 (Shift+a)
Most people do not count that as a significant cost.
and when kids come on this list and talk smsese -- i wanna do so-n-so

we chide them for keystrokes at the cost of readability.

In such a (default) setup typing a ∧ or ∨ is not possible at all without
something like a char-picker and at best has an ergonomic cost that is an
order of magnitude higher than the 'naturally available' characters.

On the other hand when/if a keyboard mapping is defined in which
the characters that are commonly needed are available, it is
reasonable to expect the ∨,∧ to cost no more than 2 strokes each
(ie about as much as an 'A'; slightly more than an 'a'. Which means
that '∨' is expected to cost about the same as 'or' and ∧ to cost less than an 'and'

Readability is another question altogether.
Random example from my machine
calendar.py line 99
If one finds this:

return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)

more readable than
return year%4=0 ∧ (year%100≠0  ∨  year%100 = 0)
then perhaps the following is the most preferred?

COMPUTE YEAR MODULO 4 EQUALS 0 AND YEAR MODULO 100 NOT
EQUAL TO ZERO OR YEAR MODULO 100 EQUAL to 0

IOW COBOL is desirable?

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Unicode in Python Rustom Mody <rustompmody@gmail.com> - 2014-04-22 22:31 -0700
  Re: Unicode in Python Chris Angelico <rosuav@gmail.com> - 2014-04-23 15:50 +1000
    Re: Unicode in Python Rustom Mody <rustompmody@gmail.com> - 2014-04-22 23:57 -0700
      Re: Unicode in Python Chris Angelico <rosuav@gmail.com> - 2014-04-23 17:06 +1000
      Re: Unicode in Python Steven D'Aprano <steve@pearwood.info> - 2014-04-23 07:29 +0000
      Re: Unicode in Python Steven D'Aprano <steve@pearwood.info> - 2014-04-23 07:53 +0000
        Re: Unicode in Python Rustom Mody <rustompmody@gmail.com> - 2014-04-23 10:59 -0700
          Re: Unicode in Python wxjmfauth@gmail.com - 2014-04-26 00:15 -0700
            Re: Unicode in Python "Frank Millman" <frank@chagford.com> - 2014-04-26 09:45 +0200
            Re: Unicode in Python Ben Finney <ben@benfinney.id.au> - 2014-04-26 17:50 +1000
            Re: Unicode in Python Ian Kelly <ian.g.kelly@gmail.com> - 2014-04-26 09:38 -0400
              Re: Unicode in Python wxjmfauth@gmail.com - 2014-04-27 07:29 -0700
              Re: Unicode in Python wxjmfauth@gmail.com - 2014-04-28 01:57 -0700
                Re: Unicode in Python random832@fastmail.us - 2014-05-01 13:21 -0400
                Re: Unicode in Python wxjmfauth@gmail.com - 2014-05-07 23:04 -0700
                Re: Unicode in Python Michael Torrie <torriem@gmail.com> - 2014-05-01 21:50 -0600
                Re: Unicode in Python wxjmfauth@gmail.com - 2014-05-03 00:46 -0700
          Re: Unicode in Python Rustom Mody <rustompmody@gmail.com> - 2014-04-27 10:39 -0700
  Re: Unicode in Python Steven D'Aprano <steve@pearwood.info> - 2014-04-23 05:52 +0000
    Re: Unicode in Python Devin Jeanpierre <jeanpierreda@gmail.com> - 2014-04-22 23:19 -0700
    Re: Unicode in Python Ben Finney <ben@benfinney.id.au> - 2014-04-23 16:41 +1000

csiph-web