public inbox for speakup@linux-speakup.org
 help / color / mirror / Atom feed
From: Chris Brannon <chris@the-brannons.com>
To: "Speakup is a screen review system for Linux."
	<speakup@linux-speakup.org>
Subject: Re: python programming
Date: Sat, 26 Jul 2014 10:31:28 -0700	[thread overview]
Message-ID: <87a97w81sf.fsf@mushroom.PK5001Z> (raw)
In-Reply-To: <alpine.BSF.2.01.1407261038400.15219@freire1.furyyjbeyq.arg> (Jude DaShiell's message of "Sat, 26 Jul 2014 10:47:45 -0400 (EDT)")

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

  reply	other threads:[~ UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
 Jude DaShiell
 ` Chris Brannon [this message]
   ` Tony Baechler
   ` Jason White
     ` Chris Brannon
       ` Kyle
         ` Rynhardt Kruger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a97w81sf.fsf@mushroom.PK5001Z \
    --to=chris@the-brannons.com \
    --cc=speakup@linux-speakup.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).