Re: How do you program in Python?

2005-07-07 Thread Jorgen Grahn
On Wed, 6 Jul 2005 14:56:09 +0200, Sybren Stuvel [EMAIL PROTECTED] wrote:
...
 I'm usually annoyed by IDEs because, for instance, they don't use VIM
 as an editor. Since I'm hooked to that, all IDEs I've used so far have
 failed to impress me.

Same here (s/VIM/Emacs/, or course).

I try not to make myself too dependent on some specialized software, because
(a) I tend to work on different Linux or Unix machines, or even on Windows
and (b) my development cycle is almost the same whether I'm programming in
Python, Perl, C++ or C (or writing in HTML, troff or LaTeX, for that
matter).

Emacs and vim are almost always installed, or trivially installable. All I
need to remember is to bring my emacs config file.

/Jorgen

-- 
  // Jorgen Grahn jgrahn@   Ph'nglui mglw'nafh Cthulhu
\X/algonet.se   R'lyeh wgah'nagl fhtagn!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do you program in Python?

2005-07-07 Thread Gregory Bond
Jorgen Grahn wrote:

 Emacs and vim are almost always installed, or trivially installable. All I
 need to remember is to bring my emacs config file.

And, fortunately, USB pen drives are now big enough to hold it!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do you program in Python?

2005-07-07 Thread Jorgen Grahn
On Thu, 07 Jul 2005 18:10:44 +1000, Gregory Bond [EMAIL PROTECTED] wrote:
 Jorgen Grahn wrote:

 Emacs and vim are almost always installed, or trivially installable. All I
 need to remember is to bring my emacs config file.

 And, fortunately, USB pen drives are now big enough to hold it!

Hey, it's not fair to make fun of emacs now that I've mentioned vim
favourably so many times ;-)

Seriously, nothing about emacs seems big or slow today. It has been
outbloated by pretty much everything else. Who could have imagined /that/
ten years ago?

/Jorgen
(And just in case this thread deteriorates into a silly emacs-vs-vi
argument, I hereby declare myself out of the game.)

-- 
  // Jorgen Grahn jgrahn@   Ph'nglui mglw'nafh Cthulhu
\X/algonet.se   R'lyeh wgah'nagl fhtagn!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do you program in Python?

2005-07-07 Thread Mike Meyer
Jorgen Grahn [EMAIL PROTECTED] writes:
 Hey, it's not fair to make fun of emacs now that I've mentioned vim
 favourably so many times ;-)

 Seriously, nothing about emacs seems big or slow today. It has been
 outbloated by pretty much everything else. Who could have imagined /that/
 ten years ago?

Actually, it hasn't. Then again, maybe it depends on how you use it. I
start an xemacs at login, and leave it running forever. Just like I do
a shell. It slowly accretes buffers as time goes by, many of them
useless (why do I need to keep traces of 14 POP sessions around?).

As a result, xemacs is usually the second biggest thing on my system

I treat most programs that way. I never exit them, just unmap them.
My WM is configured to map a single existing window, launch the
application if there is no existing window, or offer a menu of windows
if there's more than one existing window when I ask for an
application. So I tend to have a lot of old, big processes on the
system. And xemacs is usually bigger than everything but X.

And people wondered when I complained that Mac OS 9 and Windows 98
crashed a lot :-).

mike
-- 
Mike Meyer [EMAIL PROTECTED]  http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do you program in Python?

2005-07-06 Thread Dan
On 7/6/2005 5:38 AM, Jorgen Grahn wrote:
 On Sun, 03 Jul 2005 17:35:16 +0100, anthonyberet [EMAIL PROTECTED] wrote:
 ...
 
What I would really like is something like an old-style BASIC 
interpreter, in which I could list, modify and test-run sections of 
 

You probably want to check out Wing IDE 2.0.  There is a free trial.
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: How do you program in Python?

2005-07-06 Thread Sells, Fred
I'm old school and have been very happy with emacs (on windows) and the
python extensions.  I just edit my file and hit control-C twice and it runs.
I'm also using eclipse with PyDev and it's ok, but sluggish.

-Original Message-
From: anthonyberet [mailto:[EMAIL PROTECTED]
Sent: Sunday, July 03, 2005 12:35 PM
To: python-list@python.org
Subject: How do you program in Python?


My question isn't as all-encompassing as the subject would suggest...

I am almost a Python newbie, but I have discovered that I don't get 
along with IDLE, as i can't work out how to run and rerun a routine 
without undue messing about.

What I would really like is something like an old-style BASIC 
interpreter, in which I could list, modify and test-run sections of 
code, to see the effects of tweaks, without having to save it each time, 
or re-typing it over and over (I haven't even worked out how to cut and 
paste effectively in the IDLE environment).

I see lots of alternate IDEs etc, but which would allow me the simple 
interface that I have described? - I really don't know about IDEs in 
general, and I suspect I would be out of my depth with one of those.

Thanks, and feel free to mock ;)
-- 
http://mail.python.org/mailman/listinfo/python-list

---
The information contained in this message may be privileged and / or
confidential and protected from disclosure. If the reader of this message is
not the intended recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited. If you
have received this communication in error, please notify the sender
immediately by replying to this message and deleting the material from any
computer.
---
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do you program in Python?

2005-07-05 Thread Harald Armin Massa
Peter,

 I do all my work using Scite
Me too!

 So, any time I need to test the changes, I hit four keys (which at this
 point is understandably more like a chord that I hit without direct
 awareness of it) and I'm done.  Sounds pretty close to old-style BASIC
 and since I've come that route too (in the distant past), this may not
 be a coincidence.

in addition I have set up scite and paths so that F5, the scite run
command, invokes python myskript.py, with output given in the scite
output area (and saving before)
in addition, ctrl+1 does a compile (checking for syntax errors)

and exceptions are printed out in the scite output, colourcoded and
with double-click on them scite opens the appropriate script at the
offending position.

VERY quick.

Harald

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do you program in Python?

2005-07-05 Thread Tom Anderson
On Mon, 4 Jul 2005, Aahz wrote:

 In article [EMAIL PROTECTED],
 Peter Hansen  [EMAIL PROTECTED] wrote:

 After 25 years doing this, I've become something of a Luddite as far as 
 fancy IDEs and non-standard features go... and a huge believer in 
 strict decoupling between my tools, to the point of ignoring things 
 that bundle them together in ways that are, in my opinion, too tight. 
 Sorry! :-)

 +1 QOTW

+1 insight of the century. This is the heart of the unix way - lots of 
simple little programs that do exactly one thing well, and can be composed 
through simple, clean interfaces. For actually getting things done, a 
toolkit beats a swiss army knife.

tom

-- 
This isn't right. This isn't even wrong.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do you program in Python?

2005-07-05 Thread Peter Hansen
Tom Anderson wrote:
 +1 insight of the century. This is the heart of the unix way - lots of 
 simple little programs that do exactly one thing well, and can be 
 composed through simple, clean interfaces. For actually getting things 
 done, a toolkit beats a swiss army knife.

Perhaps, but I'm puzzled how that explanation would apply to emacs and 
those who use it as a swiss army knife, doing everything from editing to 
email to laundry in the same editor...

(Note: this isn't a flame about emacs, nor vi for that matter, just a 
discussion about the apparent conflict in the two philosophies embodied 
by the simple little programs and the emacs approaches.)

-Peter
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do you program in Python?

2005-07-05 Thread Grant Edwards
On 2005-07-05, Peter Hansen [EMAIL PROTECTED] wrote:
 Tom Anderson wrote:
 +1 insight of the century. This is the heart of the unix way - lots of 
 simple little programs that do exactly one thing well, and can be 
 composed through simple, clean interfaces. For actually getting things 
 done, a toolkit beats a swiss army knife.

 Perhaps, but I'm puzzled how that explanation would apply to emacs and
 those who use it as a swiss army knife, doing everything from editing to 
 email to laundry in the same editor...

It doesn't.  Emacs doesn't follow the Unix way.

 (Note: this isn't a flame about emacs, nor vi for that matter,
 just a discussion about the apparent conflict in the two
 philosophies embodied by the simple little programs and the
 emacs approaches.)

Who said there wasn't a conflict?

-- 
Grant Edwards   grante Yow!  Xerox your lunch
  at   and file it under sex
   visi.comoffenders!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do you program in Python?

2005-07-05 Thread Mike Meyer
Peter Hansen [EMAIL PROTECTED] writes:
 Tom Anderson wrote:
 +1 insight of the century. This is the heart of the unix way - lots
 of simple little programs that do exactly one thing well, and can be
 composed through simple, clean interfaces. For actually getting
 things done, a toolkit beats a swiss army knife.

 Perhaps, but I'm puzzled how that explanation would apply to emacs and
 those who use it as a swiss army knife, doing everything from editing
 to email to laundry in the same editor...

Since you asked

Unix tools require a complex environment to run in. Without a Unix
kernel (or some simulation thereof), the don't work at all. Without a
friendly shell, it's hard to get them to communicate with each other -
which is what makes building things out of the pieces so easy. If you
want to run those tools on a different OS, you have to port the
environment.

Emacs tools require a different environment: a running emacs. It's all
kept in one process, so it looks like one big program from the Unix
perspective. But it's actually a lot of smaller(*) programs running in
a shared address space. There's lots of differences between the two,
but a discussion of that is really OT for the group.

mike

*) Smaller is relative, of course. A UMA or a web browser isn't
exactly a small tool in either environment.
-- 
Mike Meyer [EMAIL PROTECTED]  http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do you program in Python?

2005-07-04 Thread dirk dierickx
On Sun, 03 Jul 2005 17:35:16 +0100, anthonyberet wrote:

 I see lots of alternate IDEs etc, but which would allow me the simple 
 interface that I have described? - I really don't know about IDEs in 
 general, and I suspect I would be out of my depth with one of those.

Eclipse and pydev are good. for testing out small routines you can use
ipython, which is great.

-- 
If you tell the truth you don't have to remember anything.
-- Mark Twain

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do you program in Python?

2005-07-04 Thread Terry Hancock
On Sunday 03 July 2005 11:35 am, anthonyberet wrote:
 What I would really like is something like an old-style BASIC 
 interpreter, in which I could list, modify and test-run sections of 
 code, to see the effects of tweaks, without having to save it each time, 
 or re-typing it over and over (I haven't even worked out how to cut and 
 paste effectively in the IDLE environment).

How old style? Basic has changed a lot over the years. ;-)

But seriously, I think I know what you mean.   I'm going to suggest that
you try going very low tech with this and don't use an IDE at all.  I'm
sure you have some form of window environment (X, Windows, or Mac)
and can open a terminal and an editor of your choice on screen (even if
it's Notepad).

Start the Python interpreter up in the terminal by just typing python.
In the interpreter you can try simple one or two liners.  You can even
define a short function and try it out.

But you'll get annoyed by having to up-arrow and retrieve lines one-
by-one to repeat the function after you've made a mistake, so that'll
get old for anything more than 5 lines long.

So, use your editor.   Type up a short program that you want to test
in the editor, then copy and paste it into the Python interpreter.  This
way, when you (inevitably) find mistakes, you can just tweak them in
the editor and then paste them again.

You can, of course, paste statements from the interpreter back into
your editor, but you'll have to avoid the  prompts (or delete them),
so it's usually better to write in the editor and paste into the interpreter.

And when you're done, you can just save the result to file so you
can get it back later.

My point is, you don't have to use a fancy all-in-one application to
do the job, nor must you run your programs from within your editor.
It's not so hard to just use tools you already understand.

Personally, I did things like this for years, and still do from time to time.
I've hardly ever used an IDE, and I'm still not totally convinced they
are worth the effort involved in learning them.  I used to hop from computer
to computer a lot, and if I tried to learn my way around separate IDEs
on Macs, Windows, DOS, Solaris, and Debian Linux, I would've spent
a lot of time twiddling with the tools instead of just writing code.

Lately, I've settled into using Vim, which is nice editor (especially if you
once wrote  a several thousand line program in Vi with nothing but a
fold-up quick reference for a manual ;-) ).  There may well be friendlier
ones, but I know this one fairly well, and it has a pretty large community
of developers who are constantly tweaking it to make it a better editor
for programming.  I only just recently started seriously customizing it
to work well with Python, though.

You can always go shopping for an IDE to buy into heavily *after*
you've learned the language.  Meanwhile, don't let trifles get in the
way -- just use your window system as your IDE.  That way, you
can pick the editor to suit you.  And the Python interpreter is great,
it will give you no trouble and quick answers.

--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do you program in Python?

2005-07-04 Thread bruno modulix
anthonyberet wrote:
 My question isn't as all-encompassing as the subject would suggest...
 
 I am almost a Python newbie, but I have discovered that I don't get
 along with IDLE, as i can't work out how to run and rerun a routine
 without undue messing about.
 
 What I would really like is something like an old-style BASIC
 interpreter, in which I could list, modify and test-run sections of
 code, to see the effects of tweaks, without having to save it each time,
 or re-typing it over and over 
(snip)
 I see lots of alternate IDEs etc, but which would allow me the simple
 interface that I have described? 

Try Emacs + python-mode. Emacs surely has a lot of warts, but I'm still
looking for a better and more versatile code editor/IDE - specially when
it comes to languages with REPL (- Read-Eval-Print Loop).

-- 
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do you program in Python?

2005-07-04 Thread Roy Smith
bruno modulix [EMAIL PROTECTED] wrote:

 Try Emacs + python-mode. Emacs surely has a lot of warts, but I'm still
 looking for a better and more versatile code editor/IDE - specially when
 it comes to languages with REPL (- Read-Eval-Print Loop).

When you build Python, make sure you build it with Gnu readline support.  
Then you can just fire up an interpreter, and use emacs (or, I suppose, vi) 
editing commands to scroll back through (and change) your input history.  
It's not as good as a real IDE, but it's still very handy for quick 
explorations.

The next step up would be to run a real emacs, do M-X shell, then fire up a 
Python interpreter inside that.

Or, go into split screen mode in emacs, editing your python source file in 
one window and running a shell in the other.  Edit some code in the source 
window, and it takes about 6 keystrokes to save it, flip to the other 
window, and re-run the file (you can get it down to a single keystroke by 
defining a simple macro and binding it to a function key).
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do you program in Python?

2005-07-04 Thread bruno modulix
Roy Smith wrote:
 bruno modulix [EMAIL PROTECTED] wrote:
 
 
Try Emacs + python-mode. Emacs surely has a lot of warts, but I'm still
looking for a better and more versatile code editor/IDE - specially when
it comes to languages with REPL (- Read-Eval-Print Loop).
 
 
 When you build Python, make sure you build it with Gnu readline support.  
 Then you can just fire up an interpreter, and use emacs (or, I suppose, vi) 
 editing commands to scroll back through (and change) your input history.  
 It's not as good as a real IDE, but it's still very handy for quick 
 explorations.
 
 The next step up would be to run a real emacs, do M-X shell, then fire up a 
 Python interpreter inside that.
 
 Or, go into split screen mode in emacs, editing your python source file in 
 one window and running a shell in the other.  Edit some code in the source 
 window, and it takes about 6 keystrokes to save it, flip to the other 
 window, and re-run the file (you can get it down to a single keystroke by 
 defining a simple macro and binding it to a function key).

Err... actually, using python-mode is *way* more simple:

[ctrl+c ! to launch the REPL (this splits the frame) if it's not already
running]
[ctrl+x o to go back to the source code buffer]

then

ctrl+c ctrl+c to execute the whole buffer in the REPL
or
select a region then ctrl+c ctrl+l to execute the selected region in the
REPL

Of course, the REPL now reflect any changes made into the source code
buffer (even if changes have not been saved) !-)


-- 
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do you program in Python?

2005-07-04 Thread Aahz
In article [EMAIL PROTECTED],
Peter Hansen  [EMAIL PROTECTED] wrote:

After 25 years doing this, I've become something of a Luddite as far as 
fancy IDEs and non-standard features go... and a huge believer in strict 
decoupling between my tools, to the point of ignoring things that bundle 
them together in ways that are, in my opinion, too tight.  Sorry! :-)

+1 QOTW
-- 
Aahz ([EMAIL PROTECTED])   * http://www.pythoncraft.com/

f u cn rd ths, u cn gt a gd jb n nx prgrmmng.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do you program in Python?

2005-07-04 Thread Chris Smith
 My question isn't as all-encompassing as the subject would
 suggest...
 
 I am almost a Python newbie, but I have discovered that I don't
 get along with IDLE, as i can't work out how to run and rerun a
 routine without undue messing about.
 
 What I would really like is something like an old-style BASIC
 interpreter, in which I could list, modify and test-run
 sections of code, to see the effects of tweaks, without having
 to save it each time, or re-typing it over and over
bruno (snip)
 I see lots of alternate IDEs etc, but which would allow me the
 simple interface that I have described?

bruno Try Emacs + python-mode. Emacs surely has a lot of warts,
bruno but I'm still looking for a better and more versatile code
bruno editor/IDE - specially when it comes to languages with REPL
bruno (- Read-Eval-Print Loop).

Emacs is an excellent long-term time investment.
See http://www.emacswiki.org  for good justice.
R,
C
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do you program in Python?

2005-07-04 Thread gene tani
+1 on investing in emacs. There's a shiny new release of the Oreilly,
which is (a really large book) that a lot of people teach themself out
of:

http://www.oreilly.com/catalog/gnu3/

But i would also recommend komodo from activestate's IDE, easy and
powerful, once you understand what all's in the menu-  toolbars:

http://www.activestate.com/Products/Komodo/?_x=1

(Maybe look at WingIDE, too, i've heard it's good)

And the python quick refs:

http://rgruet.free.fr/PQR24/PQR2.4.html
http://www.onlamp.com/pub/a/python/excerpt/PythonPocketRef/index.html

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do you program in Python?

2005-07-03 Thread Diez B. Roggisch
anthonyberet wrote:
 My question isn't as all-encompassing as the subject would suggest...
 
 I am almost a Python newbie, but I have discovered that I don't get 
 along with IDLE, as i can't work out how to run and rerun a routine 
 without undue messing about.
 
 What I would really like is something like an old-style BASIC 
 interpreter, in which I could list, modify and test-run sections of 
 code, to see the effects of tweaks, without having to save it each time, 
 or re-typing it over and over (I haven't even worked out how to cut and 
 paste effectively in the IDLE environment).
 
 I see lots of alternate IDEs etc, but which would allow me the simple 
 interface that I have described? - I really don't know about IDEs in 
 general, and I suspect I would be out of my depth with one of those.

The property of basic to have explicit linenumbering is the reason 
you've been able to work in that style of programming, as you could 
simply overwrite parts of the  program. But that's close to undoable in 
all other languages.

   Python has the interactive REPL that you can use to toy around 
interactively and is very helpful to me - especially when enriched with 
rlcompleter2. - You can even replace functions or classes while working 
and toying around. But the amount of reasonable editing work that can be 
done in the interpreter is pretty limited. You _need_ a decent editor 
for that.

So what I usually do is to create a test.py that contains the code I 
want to tinker with, and simply run that in a shell - cygwin on windows, 
but usually I work in *NIX-style environments, so it's even easier. As 
there is no compilation or whatsoever required, that works pretty well 
for me.

Diez
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do you program in Python?

2005-07-03 Thread Peter Hansen
anthonyberet wrote:
 What I would really like is something like an old-style BASIC 
 interpreter, in which I could list, modify and test-run sections of 
 code, to see the effects of tweaks, without having to save it each time, 
 or re-typing it over and over (I haven't even worked out how to cut and 
 paste effectively in the IDLE environment).

I do all my work using Scite (a nice free editor that was built to 
demonstrate the Scintilla plugin that can also be used in Python 
programs through things like the StructuredTextControl in wxPython), 
with the auto-save-on-loss-of-focus feature enabled, and a command 
prompt open in another window.

I edit in the Scite window, hit Alt-Tab (under Windows XP) to change 
focus to the cmd console (and instantly all my modified files are 
saved), press the Cursor Up key to retrieve the previous command (which 
is generally the name of my script, or a command like python 
myscript.py), and hit Enter to execute it.

So, any time I need to test the changes, I hit four keys (which at this 
point is understandably more like a chord that I hit without direct 
awareness of it) and I'm done.  Sounds pretty close to old-style BASIC 
and since I've come that route too (in the distant past), this may not 
be a coincidence.

-Peter
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do you program in Python?

2005-07-03 Thread [EMAIL PROTECTED]


anthonyberet wrote:
 My question isn't as all-encompassing as the subject would suggest...

 I am almost a Python newbie, but I have discovered that I don't get
 along with IDLE, as i can't work out how to run and rerun a routine
 without undue messing about.

 What I would really like is something like an old-style BASIC
 interpreter, in which I could list, modify and test-run sections of
 code, to see the effects of tweaks, without having to save it each time,
 or re-typing it over and over (I haven't even worked out how to cut and
 paste effectively in the IDLE environment).

I think you're missing something about IDLE if you are re-typing.

For example:

IDLE 1.1a3
 for i in range(25):
print i,

When you type the above, you get

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

Now let's say you want to re-run that with 10 instead of 25.
You don't have to re-type it. Click to place your cursor anywhere
in the original block of code and hit return. Idle will re-type
the entire block for you:

 for i in range(25):
print i,

The cursor will be at the very end of the block so you can re-run
it by hitting enter twice. But you'll get the same output.
Instead of hitting enter twice, use your cursor keys (or mouse)
to move to the 25 in the range function and edit it to 10. Once
edited, move the cursor back to end of the block and hit enter
twice to execute

 for i in range(10):
print i,


0 1 2 3 4 5 6 7 8 9

It sounds worse than it is, just takes a little getting used to.

Once you're happy with that code fragment, edit it again and add
a definition at the start.

[1] click in the block and hit enter, Idle re-types the block

 for i in range(10):
print i,

[2] place cursor in front of the 'for' and add a function name
and change the 'for' to use the parameter instead of a constant

 def t(n): for i in range(n):
print i,

[3] hit enter (here we do want to insert a line) and IDLE will
show you this (indents adjust automatically)

 def t(n):
for i in range(n):
print i,

[4] move cursor to the end of the block (after the comma)
and hit enter twice

Nothing happens. You have defined a function, but did not execute
it. To execute it, type its name with some value of n.

 t(8)
0 1 2 3 4 5 6 7

Now you can try it out with different values of n without having
to edit the whole block. Now if you want to change the function
definition, say we want each number output on a seperate line,
do the same thing we did before. Click anywhere in the block and
hit enter. The entire block is re-typed for you. Make your change
(remove the comma) and hit enter twice.

 def t(n):
for i in range(n):
print i

Again, the function is not executed. And you can always simply
click on the previously typed line t(8) and hit enter twice

 t(8)
0
1
2
3
4
5
6
7




 I see lots of alternate IDEs etc, but which would allow me the simple
 interface that I have described? - I really don't know about IDEs in
 general, and I suspect I would be out of my depth with one of those.
 
 Thanks, and feel free to mock ;)

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do you program in Python?

2005-07-03 Thread James


Peter Hansen wrote:
 anthonyberet wrote:
  What I would really like is something like an old-style BASIC
  interpreter, in which I could list, modify and test-run sections of
  code, to see the effects of tweaks, without having to save it each time,
  or re-typing it over and over (I haven't even worked out how to cut and
  paste effectively in the IDLE environment).

 I do all my work using Scite (a nice free editor that was built to
 demonstrate the Scintilla plugin that can also be used in Python
 programs through things like the StructuredTextControl in wxPython),
 with the auto-save-on-loss-of-focus feature enabled, and a command
 prompt open in another window.

 I edit in the Scite window, hit Alt-Tab (under Windows XP) to change
 focus to the cmd console (and instantly all my modified files are
 saved), press the Cursor Up key to retrieve the previous command (which
 is generally the name of my script, or a command like python
 myscript.py), and hit Enter to execute it.

 So, any time I need to test the changes, I hit four keys (which at this
 point is understandably more like a chord that I hit without direct
 awareness of it) and I'm done.  Sounds pretty close to old-style BASIC
 and since I've come that route too (in the distant past), this may not
 be a coincidence.

Just curious. Why do you Alt-Tab to a console when you can just hit F5
in SciTE? That's just 1 key instead of 4. And yes, SciTE can autosave
here too.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do you program in Python?

2005-07-03 Thread Michael Linnemann
Am Sun, 03 Jul 2005 13:40:04 -0400 schrieb Peter Hansen:

 I do all my work using Scite (a nice free editor that was built to 
 demonstrate the Scintilla plugin that can also be used in Python 
 programs through things like the StructuredTextControl in wxPython), 
 with the auto-save-on-loss-of-focus feature enabled, and a command 
 prompt open in another window.

 I edit in the Scite window, hit Alt-Tab (under Windows XP) to change 
 focus to the cmd console (and instantly all my modified files are 
 saved), press the Cursor Up key to retrieve the previous command (which 
 is generally the name of my script, or a command like python 
 myscript.py), and hit Enter to execute it.

I do the same thing without a command prompt, just pressing F5. SciTE
sure is a good editor :-)

Regards
Michael

-- 
Imagine being in a coma for a year and the hospital having to reboot your
life-support once a week. That would take a lot of the fun out of it.
As an aside, if I were on life-support, I'd rather have it run by a Gameboy
than a Windows box.   -- Cliff Wells, 2002/3/13, in comp.lang.python
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do you program in Python?

2005-07-03 Thread Mike Meyer
anthonyberet [EMAIL PROTECTED] writes:

 My question isn't as all-encompassing as the subject would suggest...

 I am almost a Python newbie, but I have discovered that I don't get
 along with IDLE, as i can't work out how to run and rerun a routine
 without undue messing about.

 What I would really like is something like an old-style BASIC
 interpreter, in which I could list, modify and test-run sections of
 code, to see the effects of tweaks, without having to save it each
 time, or re-typing it over and over (I haven't even worked out how to
 cut and paste effectively in the IDLE environment).

 I see lots of alternate IDEs etc, but which would allow me the simple
 interface that I have described? - I really don't know about IDEs in
 general, and I suspect I would be out of my depth with one of those.

 Thanks, and feel free to mock ;)

Try an emacs (Xemacs is my preference). That should come with a python
editing mode, which includes the ability to send code to a Python
interpreter running in interactive mode in another window. So what you
do is edit the code in a file on disk, and then ship it all to the
interpreter (with C-c C-c). You can then use the objects defined in
the file at the interperter prompt. After you identify a bug, you edit
the function/method in question, and ship the function/class to the
interpreter with M-C-x. You can then start playing with the new
version of the function/class to check it.

Note that this behavior isn't specific to Python. It's pretty standard
emacs support for all languages that have a REPL loop. The command
keys are even the same if you change languages.

Be warned - changing a class doesn't change the code of any objects
that were defined using the old class. So you get this sequence:

x = MyClass()
x.Test()   # reveal bug in MyClass
# edit MyClass.py, fix the bug, and M-C-x the class
x.Test()   # The bug is still there!
x = MyClass()
x.Test()   # Now it's gone.

 mike
-- 
Mike Meyer [EMAIL PROTECTED]  http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do you program in Python?

2005-07-03 Thread Peter Hansen
James wrote:
 Peter Hansen wrote:
I edit in the Scite window, hit Alt-Tab (under Windows XP) to change
focus to the cmd console (and instantly all my modified files are
saved), press the Cursor Up key to retrieve the previous command (which
is generally the name of my script, or a command like python
myscript.py), and hit Enter to execute it.
 
 Just curious. Why do you Alt-Tab to a console when you can just hit F5
 in SciTE? That's just 1 key instead of 4. And yes, SciTE can autosave
 here too.

Probably a variety of reasons.  You might say ignorance is one of them 
(since I wasn't consciously aware of that feature), but it's really that 
I deliberately choose not to use and learn about such features of 
editors because I absolutely _hate_ getting tied to such things and 
finding myself stuck in other editors or on other machines and having my 
productivity drop to zero because a simple feature is missing.

This is the same reason I no longer use any IDE, nor have any interest 
whatsoever in them other than out of simple curiosity.  I used to learn 
all kinds of details about things like VisualCafe, CodeWright, IDLE, Boa 
Constrictor, Borland C++, a dozen different Microsoft products... no 
longer!  If I didn't have Scite, I'd be able to use DOS Edit almost as 
effectively, and by observation I've concluded that using such primitive 
tools I'm often more effective than others around me who are stuck 
using the latest featureful tools...

Also, I lied when I said cursor up retrieved the name of the script. 
Since I develop using Test-Driven Development, and use a simple suite of 
utilities to manage the test files and such, I'm more often executing 
something like story015 TestCase.test03, or perhaps just u (which 
runs all unit tests in the current folder), rather than the name of the 
script which I happen to be editing.

Judging by how F5 appears to work, it wouldn't save me keystrokes 
either: I'd most likely be in some *other* file making changes (i.e. one 
of the modules under test) but would need to hit Alt-9 (or a bunch of 
Ctrl-Tabs) to switch to wherever story015.py was sitting.  The file I 
want to run won't always be the one under my cursor, nor perhaps even 
loaded.

After 25 years doing this, I've become something of a Luddite as far as 
fancy IDEs and non-standard features go... and a huge believer in strict 
decoupling between my tools, to the point of ignoring things that bundle 
them together in ways that are, in my opinion, too tight.  Sorry! :-)

-Peter
-- 
http://mail.python.org/mailman/listinfo/python-list