473,785 Members | 2,744 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.c x> ]--------------------------
Jul 18 '05 #1
7 3121

"David Mertz" <me***@gnosis.c x> wrote in message
news:ma******** *************** *************@p ython.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***@connectm ail.carleton.ca > wrote in message
news:eI******** **********@news 20.bellglobal.c om...

"David Mertz" <me***@gnosis.c x> wrote in message
news:ma******** *************** *************@p ython.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***@dalkescie ntific.com
Jul 18 '05 #5
In article <AP************ *@newsread4.new s.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.c x> wrote in message
news:ma******** *************** *************@p ython.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***@connectm ail.carleton.ca > wrote in message
news:eI******** **********@news 20.bellglobal.c om...

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
1409
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). Being a curious sort, I tried several variations of how a list comprehension *might* be constructed and got the results expected relative to the operators, but not the results I was trying to achieve. So, is it possible to achieve what the...
4
1583
by: jbailo | last post by:
and it sounds GREAT !!! http://www.virginradio.co.uk/thestation/listen/ogg.html OGG OGG OGG ! ! !
7
1825
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 that when you specify a second argument the number of elements specified in the first argument is each in turn set to the second argument. void Foo::bar(int x) { static std::vector<int> foo; std::cout << "source: " << x << std::endl;...
3
4162
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 used in MS access 2000. But i am stuck on this area, which is: ' Check for a valid speaker TryUsers
3
6223
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 the file name from a field value on the form. I also want the text to be inserted into the field. Does Dragon accept command line parameters on starting? Jackie Masson
4
1385
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 'hello'. Is there something similar in Windows and/or Linux? (If it's there in Linux presumably it only works if there
0
9643
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10147
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10087
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9947
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8971
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
4046
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.