473,395 Members | 1,624 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 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 2626
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 C:\Python23\Lib\idlelib\idle.py Traceback (most recent call last):...
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 2.4 in C:\Python24, using the .msi windows...
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 start IDLE. When I try to start it, I get an...
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 file, save a file, new file etc. It has to be open...
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 attempting to build a simple class that displays a GIF. ...
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 closed (+49) / 6883 total (+71) RFE : 223 open...
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, but what I want to know is what are the "main"...
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 crash on Windows XP (with the latest python...
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 you want to see detailed error messages, open a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.