pep 8 constants

Eric S. Johansson esj at harvee.org
Mon Jun 29 21:52:37 EDT 2009


Rhodri James wrote:

> 
> Could you elucidate a bit?  I'm not seeing how you're intending to keep
> PEP-8 conventions in this, and I'm not entirely convinced that without
> them the smart editor approach doesn't in fact reduce your productivity.
> 

thank you for asking for an elaboration.

Programming by voice has  one goal. enable a disabled person such as myself to
create code by voice with a minimum of vocal or hand damage.

let's use an example. Admittedly, this is a very simple example but hopefully it
illustrates my point

What I dictate is:

from pots is class telephone

What should generate is:

class Telephone (pots):

as you can see, taken from the simplistic expression, we generate the right
pep-8 convention. (I think). This is not the only grammar one can use but, it's
one that comes to mind that doesn't have a lot of dead ends.

So if I was dictating code, it would look something like:

>From pots is new class telephone
new constructor
first argument last mile =  between quotes copper

Second argument  fiber delivery date = between quotes when hell freezes over"

jump to body
first argument to self
second argument to self

new method construction crew

.
.
.

Telephone fieldwork = telephone second argument fiber delivery date = between
quotes hell froze over

recycled coffee = telephone fieldwork construction crew


-----------------

This is the rough example of what I think should be spoken and what can be
translated to code. What isn't shown is disambiguation techniques. For example,
when a name is said, if it is not unique to the context, then a small pop-up
shows the ambiguities and lets the user choose. Yes your focus shifts rapidly
but you're in the groove of writing code and it's just making your choices
explicit. For example, if telephone wasn't unique because we had telephone pole
and telephone truck as classes elsewhere in the namespace, you would see a
pop-up with each name with a number next to it. You could either click on the
item or say a digit to reinforce the choice. If the class had more methods, when
I say "telephone fieldwork" that gets translated into knowledge of what class
it's an instance of and all the choices are displayed but at the same time, the
natural language form are shoved into the grammar so you can continue speaking.
If you speak quickly enough, you will see no choice but the grammar will still
be loaded up so that you will get the right thing.

at each stage of the way, names get transformed into the pep-8 form without me
having to say anything special. The environment knows what form it wants and
does the transformation automatically.  I'm surprised people aren't doing this
already for their handcrafted code. It's one less bit of detail you need to pay
attention to.



More information about the Python-list mailing list