Speaking Python

Carel Fellinger carel.fellinger at chello.nl
Mon Oct 13 17:45:52 EDT 2003


On Mon, Oct 13, 2003 at 04:02:37PM -0400, David Mertz wrote:
...
> So quick test, how do you say:

without being able to test it and lacking thourough thinking I would
use at least a two pitched voice and use the lower pitched voice to
pronounce keywords, punctuation and numbers, whereas the slightly
higher pitched voice would be used for all other items.

Ofcourse indentation shouldn't be pronounced as a series of spaces,
but as an indentation level.  Likely uninformative things like token
separating spaces and newlines prior to indents and dedents can be
omitted most of the time:)

Triple quotes (''') and triple double quotes (""") should be pronounced as:
  low: triple quote
  low: triple double quote

And some might prefer tricks like:
        >>> SomeUglyIdentifier
  low:  camelcased
  high: some ugly identifier           # distinctive short pauses between words

        >>> some_other_identifier
  low:  underscore separated
  high: some other identifier          # distinctive short pauses between words

        >>> __identifier
  low:  privat
  high: identifier


Maybe using pitches is no good, as pitch in western languages is used
to help manage larger sentences.  I choose it as it seemed (on first
thought) less distracting then the obvious alternative of using two
distinct voices.  A simple user test would clear this up, though.


>     def range_sum(N):
  low:  indent level zero def
  high: range
  low:  underscore
  high: sum
  low:  paren open uppercase
  high: n
  low:  paren close colon              # newline prior to indent omitted

>         if N < 0:
  low:  indent if uppercase
  high: n
  low:  less then zero colon           # newline prior to indent omitted

>             return None
  low:  indent return camelcase
  high: none                           # newline prior to dedent omitted

>         elif N == 1:
  low:  dedent elif uppercase
  high: n
  low:  equals one colon               # newline prior to indent omitted

>             return 1
  low:  indent return 1                # newline prior to dedent omitted

>         else:
  low:  dedent else colon              # newline prior to indent omitted

>             tot = 0
  low:  indent
  high: tot
  low:  becomes zero newline

>             for n in range(1,N+1):
  low:  for
  high: n
  low:  in
  high: range
  low:  paren open 1 comma uppercase
  high: N
  low:  plus 1 paren close colon       # newline prior to indent omitted

>                 tot += n
  low:  indent
  high: tot
  low:  augmenting plus                # or simply: plus becomes?
  high: n                              # newline prior to dedent omitted

>             return tot
  low:  dedent return
  high: tot
  low:  newline


-- 
groetjes, carel





More information about the Python-list mailing list