472,334 Members | 1,431 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,334 software developers and data experts.

3 Simple Questions About Python/IDLE

1) why don't python / idle use numbered lines in their scripting, like
basic? how do you keep track of large batches of code without them?

2) in IDLE, how do you save a program such that it can be run, say from
windows the "run" function?

3) are most of you doing your script editing in IDLE or something more
fully featured?

4) how are you importing previously written blocks of code into your
code? cut and paste? what is the best way to organize snippets of
code?

thanks, peeps

Sep 7 '06 #1
14 2528
Omar wrote:
1) why don't python / idle use numbered lines in their scripting, like
basic? how do you keep track of large batches of code without them?

2) in IDLE, how do you save a program such that it can be run, say from
windows the "run" function?

3) are most of you doing your script editing in IDLE or something more
fully featured?

4) how are you importing previously written blocks of code into your
code? cut and paste? what is the best way to organize snippets of
code?

thanks, peeps
1) Python is very different from what you expect being experienced in
programming with Basic. My recommendation: don't hesitate to take the
time to read the Python manual.
2) Double click on saved Python script (hope you are able to save a
file? Haven't you detected that you can edit and run a file in IDLE?)
3) Plain text editor or IDLE are good. For more see Python website -
there are plenty options to choose from.
4) using 'import' (see recommendation in 1))

Claudio Grondi
Sep 7 '06 #2
thanks

Sep 7 '06 #3
thanks.

i have saved and double clicked as suggested. when I save and double
click a simple "hello program", the b&w python shell briefly comes up,
then disappears. is this how it should work?

Sep 7 '06 #4
Omar schrieb:
thanks.

i have saved and double clicked as suggested. when I save and double
click a simple "hello program", the b&w python shell briefly comes up,
then disappears. is this how it should work?
Yes. because when your program terminates, the shell terminates. Or
would you prefer it sticking around, cluttering screen space?

If you want it to stay, make your program require a key-press in the
end. something like this:

raw_input("press return")
Diez
Sep 7 '06 #5
Omar wrote:
thanks.

i have saved and double clicked as suggested. when I save and double
click a simple "hello program", the b&w python shell briefly comes up,
then disappears. is this how it should work?
Yes, that is how it should work. Program is doing what you
told it to. print "hello program" and exit (which closes the window).
If you want it to pause put something after the print like:

t=raw_input('Hit return to continue')

This way the program will pause until you hit return.

Good luck.

-Larry Bates
Sep 7 '06 #6
thank you genteman.

however, its not working :(

I resaved it, but same thing.

Sep 7 '06 #7
Omar wrote:
thank you genteman.

however, its not working :(

I resaved it, but same thing.
Please post some code so we can actually do something more than
read your mind. You can also run the program from a shell
instead of from idle to see what happens.

-Larry Bates
Sep 7 '06 #8
sure...
>>print "hello world"
hello world
>>t=raw_input('Hit return to continue')
I'm saving it as "helloworld11", then double clicking the icon I saved
it as.

Sep 7 '06 #9
okay...

I got to work using the SCITE editor with

print "hello world" # here we are once again
raw_input("press return")

cool!

Sep 7 '06 #10
Omar,

The '>>>' were causing the problem I would guess. Those are the
interactive interpreter's prompts, not python. Saving a python session
like that is a starting place for creating code, not the finished
product.

You might also want to save the file as "helloworld11.py" before double
clicking it.

Again, these problems indicate that you're not ready to even start
coding until you've read a good intro text.

John Purser

On Thu, 2006-09-07 at 09:11 -0700, Omar wrote:
okay...

I got to work using the SCITE editor with

print "hello world" # here we are once again
raw_input("press return")

cool!
Sep 7 '06 #11
I'm working through a tutorial,
http://swaroopch.info/text/Byte_of_Python:Control_Flow, and I sorta
can't get through the tutorial without overcoming these little
speedbumps. This is why I'm asking these questions.

Sep 7 '06 #12
On 2006-09-07, Dennis Lee Bieber <wl*****@ix.netcom.comwrote:
On 7 Sep 2006 06:53:44 -0700, "Omar" <ou*************@hotmail.com>
declaimed the following in comp.lang.python:
>1) why don't python / idle use numbered lines in their
scripting, like basic? how do you keep track of large batches
of code without them?

Because BASIC was created in the days of paper teletypes with
minimal editors. In BASIC, you would correct a line by retyping it with
the line number and the interpreter was responsible for "reordering" the
lines in memory. You could actually type a program in from last line to
first (ie, upside down) and it would run.

NO other language that I know of uses line numbers to control
source code order. Heck, Visual BASIC doesn't use line numbers
either (I don't recall if AmigaBASIC required them either).
(Nope.)

--
Neil Cerutti
Sep 7 '06 #13
Dennis Lee Bieber wrote:
On 7 Sep 2006 06:53:44 -0700, "Omar" <ou*************@hotmail.com>
declaimed the following in comp.lang.python:

>>1) why don't python / idle use numbered lines in their scripting, like
basic? how do you keep track of large batches of code without them?

Because BASIC was created in the days of paper teletypes with
minimal editors. In BASIC, you would correct a line by retyping it with
the line number and the interpreter was responsible for "reordering" the
lines in memory. You could actually type a program in from last line to
first (ie, upside down) and it would run.

NO other language that I know of uses line numbers to control source
code order. Heck, Visual BASIC doesn't use line numbers either (I don't
recall if AmigaBASIC required them either).
Well, there was Focal. Focal used floating-point line numbering, making
it much easier to squeeze extra lines in at any point int he program.

regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden

Sep 7 '06 #14
At Thursday 7/9/2006 13:44, Omar wrote:
>I'm working through a tutorial,
http://swaroopch.info/text/Byte_of_Python:Control_Flow, and I sorta
can't get through the tutorial without overcoming these little
speedbumps. This is why I'm asking these questions.
Have you read the Python tutorial which comes with the documentation?
You can read it online at <http://docs.python.org/tut/tut.html>

Gabriel Genellina
Softlab SRL


__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!
http://www.yahoo.com.ar/respuestas

Sep 12 '06 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Vin Jovanovic | last post by:
Trying to start Python IDLE through Start>Programs>Python 2.3> IDLE doesn't work From DOS ... I get this .... C:\>python...
5
by: StepH | last post by:
Hi, I'm new to Python. I'm working under XP, and I've alot of prob. (not with the langage itself, but with the tools): I've install Pyhton...
8
by: DavidHolt | last post by:
I have a problem that I see on two different machines, one running XP SP1 and one XP SP 2. On both I installed Python 2.4. I can't seem to...
4
by: Jonathan Fine | last post by:
Hi I'm looking for a simple Python + Tk text editor. I want it as a building block/starting point. I need basic functions only: open a...
4
by: john.orlando | last post by:
Hello, I'm a newbie to Python (literally, within the last two weeks), and I am playing around with Tkinter to build some simple GUIs. I am...
0
by: Kurt B. Kaiser | last post by:
Patch / Bug Summary ___________________ Patches : 393 open (+15) / 3315 closed (+17) / 3708 total (+32) Bugs : 908 open (+22) / 5975...
4
by: renguy | last post by:
I am interested in making some changes and additions to the Python environment (Python and IDLE). I have the source code and can build the source,...
3
by: writser | last post by:
hey all, For my study I'm writing a simple threaded webcrawler and I am trying to do this in python. But somehow, using threads causes IDLE to...
0
by: Rajanikanth Jammalamadaka | last post by:
There seems to be a bug with idle on Mac OS X. http://bugs.python.org/issue4017 It has to do something with reinstalling the TCL and TK. If...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.