473,407 Members | 2,326 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Speaking Python

In the endless Lisp/macro threads, Alex Martelli mentioned something a
bit interesting about screen-reading applications. Specifically, he
expressed reservations about whether Python would be a good language for
visually impaired or blind programmers.

The concern, I think, is that pronouncing
'space-space-space-space-space-space-space-space' isn't all that easy to
follow if spoken with every line. Even a reduced form like
"eight-spaces' isn't perfect either. Actually, a symmetric concern is
with voice recognition applications--perhaps for people with motor
disabilities.

My feeling is that a good vocal Python programming editor would need to
know a bit about the structure of the language. Maybe to a greater
degree than would one with explicit delimiters (although I have trouble
imagining blind programmers being all that happy with hearing
'close-paren-close-paren-close-paren-close-paren-close-paren-close-paren'
either). Perhaps this same hypothetical editor would speak code and
recognize spoken code using the same format.

So quick test, how do you say:

def range_sum(N):
if N < 0:
return None
elif N == 1:
return 1
else:
tot = 0
for n in range(1,N+1):
tot += n
return tot

It's a stupid function, of course; I just wanted something with a couple
of levels of indents for an example. There's no need to tell me it's
pronouned 'sum-of-range-of-N-plus-one'.

Yours, David...

--
---[ to our friends at TLAs (spread the word) ]--------------------------
Echelon North Korea Nazi cracking spy smuggle Columbia fissionable Stego
White Water strategic Clinton Delta Force militia TEMPEST Libya Mossad
---[ Postmodern Enterprises <me***@gnosis.cx> ]--------------------------
Jul 18 '05 #1
7 3102

"David Mertz" <me***@gnosis.cx> wrote in message
news:ma************************************@python .org...
So quick test, how do you say:

def range_sum(N):
if N < 0:
return None
elif N == 1:
return 1
else:
tot = 0
for n in range(1,N+1):
tot += n
return tot


def range underscore sum open bracket n close bracket colon new line indent
if n less than zero colon newline indent
return none newline dedent
elif n equals equals 1 colon newline indent
return 1 newline dedent
else colon newline indent
tot equal zero newline
for n in range open bracket 1 comma n plus 1 close bracket colon newline
indent
tot plus equal n newline dedent
return tot newline dedent
dedent

(this assumes that the user is aware that if no indent or dedent message is
given, the current level of indentation should be maintained).
Jul 18 '05 #2

"Sean Ross" <sr***@connectmail.carleton.ca> wrote in message
news:eI******************@news20.bellglobal.com...

"David Mertz" <me***@gnosis.cx> wrote in message
news:ma************************************@python .org...
So quick test, how do you say:

def range_sum(N):
[snip]
def range underscore sum open bracket n close bracket colon new line

indent

+1, except:
open/close paren= ()
open/close brace = {}
open/close bracket = []

Emile van Sebille
em***@fenx.com
Jul 18 '05 #3
"Emile van Sebille" <em***@fenx.com> wrote in message >
[snip]
+1, except:
open/close paren= ()
open/close brace = {}
open/close bracket = []


heh. you're right.

I usually say
open/close bracket = ()
open/close curly bracket = {}
open/close square bracket = []
but yeah, parentheses, braces and brackets are just as clear.
Jul 18 '05 #4
David Mertz:
So quick test, how do you say:

def range_sum(N):
if N < 0:
return None
elif N == 1:
return 1
else:
tot = 0
for n in range(1,N+1):
tot += n
return tot


Here's how I would say it to someone who is typing
for me, given that the person knows some Python syntax
and given an editor which does auto indentation -- the
proverbial man-behind-the-curtains approach to speech
recognition:

Define a new function named range underscore sum which takes
a single parameter, capital N.

If n is less than 0, return none.
If n is 1, return 1
otherwise
start with tot equal to 0 (that's tee-oh-tee; short for the total)
for n, which is lowercase n this time, in range starting at 1 and
going to capital n plus 1 ... close-parens colon newline
tot plus equals lower-case n
backspace once
return tot

This depends on seeing the text as it's typed. I think if I
did this over the phone I would say "if n equals equals 1" and
be a bit more specific about the colons and pressing enter.

Andrew
da***@dalkescientific.com
Jul 18 '05 #5
In article <AP*************@newsread4.news.pas.earthlink.net> , Andrew Dalke wrote:
> Here's how I would say it to someone who is typing
for me, given that the person knows some Python syntax
and given an editor which does auto indentation -- the
proverbial man-behind-the-curtains approach to speech
recognition:

Define a new function named range underscore sum which takes
a single parameter, capital N.

If n is less than 0, return none.
If n is 1, return 1
otherwise
I tried writing this blindly, and almost got the same code except for that
second If, where I got:

if N is 1:
return 1

Two mistakes: 1. due to the lack of "otherwise", I assumed an "if" instead of
an "elif"; 2. the difference between "=", "==", and "is" is important to
nail down.
backspace once


I think "dedent" would be a better choice than "backspace".

--
..:[ dave benjamin (ramenboy) -:- www.ramenfest.com -:- www.3dex.com ]:.
: d r i n k i n g l i f e o u t o f t h e c o n t a i n e r :
Jul 18 '05 #6
Sean Ross wrote:
"David Mertz" <me***@gnosis.cx> wrote in message
news:ma************************************@python .org...
So quick test, how do you say:

def range_sum(N):
if N < 0:
return None
elif N == 1:
return 1
else:
tot = 0
for n in range(1,N+1):
tot += n
return tot


def range underscore sum open bracket n close bracket colon new
line indent if n less than zero colon newline indent
return none newline dedent
elif n equals equals 1 colon newline indent
return 1 newline dedent
else colon newline indent
tot equal zero newline
for n in range open bracket 1 comma n plus 1 close bracket colon
newline indent
tot plus equal n newline dedent
return tot newline dedent
dedent

(this assumes that the user is aware that if no indent or dedent
message is given, the current level of indentation should be
maintained).


This seems pretty good to me, although I'd let 'colon' imply a
subsequent indent. Line breaks would be indicated by pauses and pitch
changes, which I think would be true in the above as well.

def range underscore sum open paren n close paren colon
if n less than zero colon
return none dedent
elif n equal-equal 1 colon
return 1 dedent
else colon
tot equal zero
for n in range open paren 1 comma n plus 1 close paren colon
tot plus equals n dedent
return tot
dedent
dedent

I would probably use "paren" to mean "open paren" as well, although
explicit might be better there. I once worked as a proofreader, where
one task was to record written material in a fairly stylized manner
similar to this. Punctuation was explicitly pronounced, as was space
where it was unusual. The listeners could generally make the best
sense of the minimum information; too much would slow reading down to
the point that comprehension suffered. Conventions (in reading) that
were usually honored tended to work better than explicit statement of
what was expected.

In code like:
if n < 3: break # don't worry about this stuff
The colon convention above would have to be overridden explicitly, so
it would come out more like Sean's reading.
if n less than three colon no-newline break [ and perhaps, "comment
don't worry about this stuff" ]

--
rzed
Jul 18 '05 #7
"Sean Ross" <sr***@connectmail.carleton.ca> wrote in message
news:eI******************@news20.bellglobal.com...

def range underscore sum open bracket n close bracket colon new line indent if n less than zero colon newline indent
[etc]

(this assumes that the user is aware that if no indent or dedent message is given, the current level of indentation should be maintained).


I'm not sure this is a valid assumption, for two reasons:

a) I'm not sure that sighted readers keep track of the previous indentation
level when reading code: isn't it more the case that the amount of
whitespace at the start of each line gives you an idea of the scope of the
line's statements?

b) It's optimised for the straight read-through, from beginning to end. This
is proably the common case when reading other people's code, but when
editing or debugging your own code you're much more likely to be jumping
around from line to line.

Maybe reading the level of indentation at the start of each line ("indent 2:
if N less-than zero colon / indent 3: return None") would be more useful?

James
Jul 18 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Chinook | last post by:
I'm probably just getting languages mixed up, but I thought in my Python readings over the last couple months that I had noticed an either/or expression (as opposed to a bitwise or, or truth test)....
4
by: jbailo | last post by:
and it sounds GREAT !!! http://www.virginradio.co.uk/thestation/listen/ogg.html OGG OGG OGG ! ! !
7
by: Neil Zanella | last post by:
OK, this time the compiler's got me a little bit puzzled, simply because it is doing something I am not expecting. My understanding, according to the documentation of std::vector<>::resize(), is...
3
by: Farouq | last post by:
dragon naturally speaking professional version 6.1 Hi all i have recently downloaded some examples from the dragon website in vb. I have managed to change some code to vba so that it could be...
3
by: jackiemasson | last post by:
Hi, I want to start Dragon Naturally Speaking when the user enters a field on an Access form and stop when they exit the field. I would like to save the audio file to a specific folder and pass...
4
by: David C. Ullrich | last post by:
Mac OS X has text-to-speech built into the interface. So there must be a way to access that from the command line as well - in fact the first thing I tried worked: os.system('say hello') says...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.