Re: Looking At Python Programming

  • From: "R Dinger" <rrdinger@xxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Mon, 6 Jun 2011 08:13:00 -0700

Hi,

I agree, get used to indenting all code.  That is the way programming is 
done and it actually helps you think in terms of code blocks.

And your screen reader can announce indent levels changes to remind you.

Richard
----- Original Message ----- 
From: "Q" <q@xxxxxxxxxxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Sunday, June 05, 2011 8:23 PM
Subject: Re: Looking At Python Programming


While PyBraces and similar is a generally good idea, I strongly
recommend actually getting familiar with the indentation scheme of Python.
As David wrote, this is generally quite simple with a screen reader. It
has many benefits:
• It allows you to code anywhere with Python installed, a far greater
subset of computers than that with both Python and PyBraces installed.
• When writing in languages which use braces for scope control, such as
C, Java, C++, whatever, indentation is still important. If you're
working on code that you're sharing with sighted people, the expectation
will be that you indent. Python gets you into this habit.
• Using indentation alone is generally more efficient for communicating
information to a blind person. Observe:

def do_something(arg1, arg2): {
assert ([isinstance(i, (int, long)) for i in arg1, arg2])
if arg1 < arg2: {
#Take an action here
}
else: {
#Do something else here
}
}

Compare to:

def do_something(arg1, arg2):
(one space.) assert ([isinstance(i, (int, long)) for i in arg1, arg2])
if arg1 < arg2:
(2 spaces.) #do something here
(one space.): else:
(two spaces.) #Something else

I placed in leading parentheses the text which is spoken by the screen
reader as you navigate from line to line. Note that if two lines are on
the same indentation, the indentation will not be announced. Which makes
it really trivial to actually spot where indentation changes.
Compare to braces, where you have to keep in your head not only code
scope, but what braces go with what, as well as brace matching heuristics.
When working in a braced language, I often use comments to indicate what
the closing brace signifies. For instance } //Endif, } //end function
do_something. This is simply something which is unnecessary when reading
an indented language.

In short, spend the slight extra time to do it right, and you'll reap
the benefits, just like most other things in life, and especially
programming.

I welcome your thoughts and feedback,
Q



On 6/5/2011 7:02 PM, David Tseng wrote:
> As another aside, it's not difficult to write a script (given whatever
> screen reader you're using) to announce the indentation of a given
> body of text.  Just override the say line (prev, current, next) and do
> the preprocessing to calculate the space/tabs indent before speaking
> the line's contents.
>
> With that said, not sure why no one's pointed out that Jaws comes with
> such a feature already:
> Jaws-v,
> type "indent"
> toggle indent to "indicate".
>
>
> Sucha feature exists in other screen readers as well.
>
> Finally, though I've not used it, EdSharp and something called the
> settings packager contains this so beloved but mysterious
> SoundsForStuff sound scheme.  Not sure why all the folks on list who
> use EdSharp haven't piped up about this, but there you go.
> http://empowermentzone.com/EdSharp.htm
>
> On 6/5/11, Trouble<trouble1@xxxxxxxxxxxxxxx>  wrote:
>> If you have jaws 8 and up then you have the sound
>> schemes feature. There has to be a configuration
>> file for the program being used for it to show.
>> It will use any sound you give it for what ever action you want it to 
>> take.
>> At 07:48 AM 6/5/2011, you wrote:
>>> I originally got it from someone on this list, I think it was James
>>> Hommes. No, it does not come with jaws by default. However, you can
>>> tell jaws to speak indentation if you have no other option.
>>>
>>> On 6/5/11, Oriol Gómez<ogomez.s92@xxxxxxxxx>  wrote:
>>>> Where is this sounds4stuff scheme? I don't htink ti comes with jaws.
>>>>
>>>> On 6/5/11, Ken Perry<whistler@xxxxxxxxxxxxx>  wrote:
>>>>>
>>>>> You will learn to not make mistakes like this over time but as a
>>>>> starter
>>>>> you
>>>>> might want to use the ed sharp command to change your python from
>>>>> normal
>>>>> to
>>>>> braces then look at the output.  It will help you find the problem by
>>>>> failing to put braces where you think they should be.
>>>>>
>>>>>
>>>>>
>>>>> Ken
>>>>>
>>>>> From: programmingblind-bounce@xxxxxxxxxxxxx
>>>>> [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Harmony
>>>>> Neil
>>>>> Sent: Saturday, June 04, 2011 4:38 PM
>>>>> To: programmingblind@xxxxxxxxxxxxx
>>>>> Subject: Looking At Python Programming
>>>>>
>>>>>
>>>>>
>>>>> I can't remember if attachments are permitted on this list or not, so 
>>>>> I
>>>>> apologize in advance. I've been looking at functions and stuff in the
>>>>> python
>>>>> tutorials and although I copied them character for character, as far 
>>>>> as
>>>>> I
>>>>> know, I get an error saying that there is an unexpected indentation.
>>>>> Would
>>>>> anyone be able to let me know if you find any problems with the
>>>>> indentation?
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Harmony.
>>>>>
>>>>>
>>>> __________
>>>> View the list's information and change your settings at
>>>> http://www.freelists.org/list/programmingblind
>>>>
>>>>
>>>
>>> --
>>> Have a great day,
>>> Alex (msg sent from GMail website)
>>> mehgcap@xxxxxxxxx; http://www.facebook.com/mehgcap
>>> __________
>>> View the list's information and change your settings at
>>> http://www.freelists.org/list/programmingblind
>> __________
>> View the list's information and change your settings at
>> http://www.freelists.org/list/programmingblind
>>
>>
> __________
> View the list's information and change your settings at
> http://www.freelists.org/list/programmingblind
>

__________
View the list's information and change your settings at
http://www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at 
http://www.freelists.org/list/programmingblind

Other related posts: