How do you code in Python ???

Philip Swartzleonard starx at pacbell.net
Fri May 17 07:15:58 EDT 2002


Shagshag || Fri 17 May 2002 01:47:09a:

> Hello,
> 
> Newbie to python, i was wondering how *skilled* guys code with it :
> 
> By now to write a function i write it in a text editor (with coloured
> syntax), copy and paste it in idle try it, then go back to text
> editor to debug it and so on until i've tuned it like i want, then
> next function and so on until i complete module... And that's really
> boring theses permanent back and forth...
> 
> So how do you do it ? Which tools do you use ?

I'm usually writing application-like (or at least self-executing as 
opposed to library) code, so I usually have the file on my desktop or in 
an open window and double-click it when I'm done with some changes. To 
make the changes, I use NT-Emacs, which is possilby the most powerful 
text editor on earth darkened only by the fact that it has a learning 
curve as steep as everest (well, if you want to customize it a lot at 
least, if you like everything as can be changed by the configuration 
program it's significantly easier, though still hard with the key-
combinations if you don't have a good memory for that kind of thing.)

If i forget how to use a certin language feature or want to test some 
mostly standalone function or class (like i'm coding 'inverse_slope' in 
a graphical LOS-test program and want to make sure it's right easily), 
or if i forget/don't know how to use some particular language feature, I 
fire up IDLE and poke it. (E.G. if i want to know exactly how to make 
the range [20,-1) properly).
 
> (i'm on window, freeware if possible or not to expensive...)
> 
> Another one is which are "standard" coding in Python ? 
> 
> (thing like initCap, postfix private atribute with "_" and so on)

There's a pep on this, or Guido's Divine Code of Python Style. 
Personally, i name fuctions and methods like_this(), and classes 
Like_this, and try to use whitespace resonably with parentheseis 
(usually by seperating the outermost ones in a complex set from thier 
contents, like foo( (do(a)+some(b)) * (complicated(stuff(see))) ) -- 
this is a variation of a lisp habit where i seperate parens ending 
groups on line from those ending multi-line sets...). Other than that, i 
think i don't have any signficant diffrences with the recommended style 
=). 

(Oh yeah, and there's the 'make new code in a file/set follow the same 
convetions as are already there' rule, in general).

... bed =)

-- 
Philip Sw "Starweaver" [rasx] :: www.rubydragon.com



More information about the Python-list mailing list