public inbox for speakup@linux-speakup.org
 help / color / mirror / Atom feed
* python programming
@  Jude DaShiell
   ` Chris Brannon
  0 siblings, 1 reply; 7+ messages in thread
From: Jude DaShiell @  UTC (permalink / raw)
  To: speakup

I'm studying python now and will be for some time to come.   One 
unfortunate python requirement is the use of blank lines to end loops.  I 
found substituting those blank lines with comments helps my readability 
when debugging.
Since I use emacs to do my coding, hitting tab once puts me in the correct 
indentation location after going to a new line.  I don't have pyindent 
installed, I'm not sure how useful that package will be and haen't yet 
done python customization for accessibility yet since I don't yet know 
what ought to be changed to improve accessibility for screen reader users 
running linux in a command line environment yet.  Maybe google can find me 
information along these lines.



jude <jdashiel@shellworld.net>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: python programming
   python programming Jude DaShiell
@  ` Chris Brannon
     ` Tony Baechler
     ` Jason White
  0 siblings, 2 replies; 7+ messages in thread
From: Chris Brannon @  UTC (permalink / raw)
  To: Speakup is a screen review system for Linux.

Jude DaShiell <jdashiel@shellworld.net> writes:

> unfortunate python requirement is the use of blank lines to end loops.  I 
> found substituting those blank lines with comments helps my readability 

Yes, I've known a couple of blind Python programmers who add a comment
at the close of a block.

while foo:
    doSomething()
    if blargh:
      doBlargh()
    #end if
#end while

But since you're already using emacs, it has lots of features that will
let you move through code.
I'll give both keybindings and emacs function names.  Of course, these
will only work in python-mode, but since smart indenting is already
working for you, I assume you're already using python-mode.

function name: py-beginning-of-block
keybinding: C-c C-u
Description: Move to the beginning of the current block.  E.G., if
you're in a loop body, jump to the for or while.

Function: py-end-of-block
keybinding: C-c C-q
description: jump to the end of the block.  E.G., if you're in a loop
body, go to where the closing brace would be in a "bracy" C-like
language.  This actually takes you to the last character of the block.
Play with it and get a feel for it.

function: py-beginning-of-statement
keybinding: C-c C-p
description: Go to the beginning of a simple (non-compound statement)
For compound statements, use the block movement commands described above.

function: py-end-of-statement
keybinding: C-c C-n
description: Go to the end of the simple statement.  It takes you to the
last character.

Function: py-beginning-of-def-or-class
keybinding: C-M-a
description: Move to the beginning of a class or function definition.

function: py-end-of-def-or-class
keybinding: C-M-e
description: move to the end (last character) of a class or function
definition

There are also some equivalent functions that will move you to the end
of something and then find the next newline.
For instance, py-end-of-block-bol will take you to the end of the block
and then past the next newline, so that point is at column 0 on the line
following the end of the block.  As far as I can tell, there are no
keybindings for those, but you could always make your own.

python-mode has lots of useful stuff.  I'm just scratching the surface.
I've had to learn all this by playing around and looking at python-mode
source, so hopefully I've pointed someone in the right direction, as
opposed to misdirecting them!
In my experience, emacs is hands-down the best way for a blind
person to write Python on Linux.  We need a really good tutorial for it.
Maybe this is a start.

-- Chris

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: python programming
   ` Chris Brannon
@    ` Tony Baechler
     ` Jason White
  1 sibling, 0 replies; 7+ messages in thread
From: Tony Baechler @  UTC (permalink / raw)
  To: Speakup is a screen review system for Linux.

> In my experience, emacs is hands-down the best way for a blind
> person to write Python on Linux.  We need a really good tutorial for it.
> Maybe this is a start.
> 
> -- Chris

Someone might want to look at the various Python tutorial sites, such as
Dive Into Python.  Perhaps the developers of those sites could be convinced
to add an Emacs tutorial for Python mode.  I'm not a programmer and I don't
know if the tutorial sites are still updated, but it's just a thought.  If
there is already a good tutorial, it would seem logical and not too
difficult to add an Emacs section to it.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: python programming
   ` Chris Brannon
     ` Tony Baechler
@    ` Jason White
       ` Chris Brannon
  1 sibling, 1 reply; 7+ messages in thread
From: Jason White @  UTC (permalink / raw)
  To: speakup

Chris Brannon <chris@the-brannons.com> wrote:
> Jude DaShiell <jdashiel@shellworld.net> writes:
> 
> > unfortunate python requirement is the use of blank lines to end loops.  I 
> > found substituting those blank lines with comments helps my readability 
> 
> Yes, I've known a couple of blind Python programmers who add a comment
> at the close of a block.
> 

Blocks are also marked by indentation, which is part of Python's syntax, not a
purely stylistic convention as it is in C, for instance.

In Python and other code editing modes, Emacspeak reads the indentation of
each line. I don't know whether Speakup can be configured to do this.

Of course, a braille display is an invaluable tool for reading and editing any
kind of text, including Python code.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: python programming
     ` Jason White
@      ` Chris Brannon
         ` Kyle
  0 siblings, 1 reply; 7+ messages in thread
From: Chris Brannon @  UTC (permalink / raw)
  To: Speakup is a screen review system for Linux.

Jason White <jason@jasonjgw.net> writes:

> Blocks are also marked by indentation, which is part of Python's syntax, not a
> purely stylistic convention as it is in C, for instance.

Yes, but the reason some people mark blocks is so that the ends can be
found quickly, with a text search.  It's not fool-proof, but it works
for people who don't have a syntax-aware editor.
But python-mode is much better for moving through code.

> In Python and other code editing modes, Emacspeak reads the indentation of
> each line. I don't know whether Speakup can be configured to do this.

Not automatically.  Someone has a patch out to do something similar with
tones, I think.  In Speakup, to hear the indentation, you press numpad 8
twice on the line that you're reading with the review cursor.

-- Chris

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: python programming
       ` Chris Brannon
@        ` Kyle
           ` Rynhardt Kruger
  0 siblings, 1 reply; 7+ messages in thread
From: Kyle @  UTC (permalink / raw)
  To: speakup

Orca has a setting that will speak indentation. It's especially good for
Python, where spacing matters. You can find the setting in preferences
-> speech -> speak indentation and justification. If this option is
turned on, a line all the way to the left is just read out normally, and
an indented line will speak the number of spaces of indentation at the
beginning of the line. With this option turned on, it is possible to
correctly write Python scripts in any editor, even Gedit and Pluma. Hope
this helps.
~Kyle
http://kyle.tk/
-- 
"Kyle? ... She calls her cake, Kyle?"
Out of This World, season 2 episode 21 - "The Amazing Evie"

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: python programming
         ` Kyle
@          ` Rynhardt Kruger
  0 siblings, 0 replies; 7+ messages in thread
From: Rynhardt Kruger @  UTC (permalink / raw)
  To: Speakup is a screen review system for Linux.

A while ago I modified Speakup to beep when moving by line, with the
pitch of the beep reflecting the line's indentation. You can find the
git repo at:

git://github.com/rynkruger/speakup.git

This version contains a new object in /sys/accessibility/speakup
called indent_beep. Echo 1 to this file to enable the feature.
Take care,

Rynhardt

On 7/28/14, Kyle <kyle4jesus@gmail.com> wrote:
> Orca has a setting that will speak indentation. It's especially good for
> Python, where spacing matters. You can find the setting in preferences
> -> speech -> speak indentation and justification. If this option is
> turned on, a line all the way to the left is just read out normally, and
> an indented line will speak the number of spaces of indentation at the
> beginning of the line. With this option turned on, it is possible to
> correctly write Python scripts in any editor, even Gedit and Pluma. Hope
> this helps.
> ~Kyle
> http://kyle.tk/
> --
> "Kyle? ... She calls her cake, Kyle?"
> Out of This World, season 2 episode 21 - "The Amazing Evie"
> _______________________________________________
> Speakup mailing list
> Speakup@linux-speakup.org
> http://linux-speakup.org/cgi-bin/mailman/listinfo/speakup
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~ UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
 python programming Jude DaShiell
 ` Chris Brannon
   ` Tony Baechler
   ` Jason White
     ` Chris Brannon
       ` Kyle
         ` Rynhardt Kruger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).