Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Confused(python question)

  1. Aug 15, 2009 #1
    I'm using Windows Vista. Just thought I'd throw that out there.So i downloaded python 3.1. And it's like now what? After my thread about c++ i have decided to infact try out python. But i can't seem ot figure it out. Why isn't it as simple as opening up a source page? All this stuff about intepreter and what not. I'm feeling pretty stupid today so that might be it. So, I have it downloaded what now?
     
  2. jcsd
  3. Aug 15, 2009 #2

    Hurkyl

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    When you run an interpreter like python (or other languages like Mathematica or a linux prompt, or a "DOS" prompt), you don't need source files: you just type commands and they happen immediately.


    Should you want to make a source file (called a "script"), you can, with whatever editor you like, and then invoke python to run the script. I confess that I've never used python in this way in an IDE, so I'm not sure if I can help if you're specifically keeping that type of solution. My uses of python have been of the form:

    Run python and execute commands directly.
    In this mode, I do sometimes edit commands in a text editor, then copy/paste those commands into python. Or, I might sometimes use the import command to load and execute a "module"​

    Run a python GUI, such as IDLE (it's a free download from somewhere).
    I use this mode pretty much the same as the previous one. But the GUI makes it easier to deal with mistakes in typing. (e.g. so I don't have to use a text editor and use copy/paste). I have never tried to create/use scripts in this mode​

    Create python scripts, and invoke them with python <script name>.
    In this mode, I am typically executing python from a command line (e.g. a linux prompt, or a DOS prompt), and editing my python scripts in my favorite text editor, such as xemacs
     
  4. Aug 15, 2009 #3

    Hurkyl

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    I would not be surprised if there are programs that are IDE-like -- where it pops up a text editor and you edit directly, then press a button to execute the script. I just don't know of any.
     
  5. Aug 15, 2009 #4
    My usual mode if I'm doing something more than a few lines long is to use a text editor to make a Python script in my Python directory. I have my pythonpath variable set up so that I can import or reload() my script in the interpreter, as I edit the file. My script tends to be a bunch of function definitions so there are no side effects to reload()ing.
     
  6. Aug 16, 2009 #5
    The following video tutorials may help:

    1) Python tutorial for beginners by Rustomac
    (Note: You don't need the semicolons after every line)

    2) Python Programming Tutorials by thenewboston
    This is a series of tutorials, in total 43 videos.
     
  7. Sep 7, 2009 #6
    Install idle and run in linux with python <path to idle.py>
    In windows you get a bat file

    Idle is a basic ide for python
     
  8. Sep 7, 2009 #7
    It is from eric idle the python member
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Confused(python question)
  1. Basic Python questions (Replies: 5)

  2. Simple python question (Replies: 2)

  3. Python 3 question (Replies: 4)

  4. Basic python question (Replies: 2)

Loading...