Page 2 of 5 FirstFirst 1234 ... LastLast
Results 11 to 20 of 42

Thread: Advice in getting started with Python

  1. #11
    Join Date
    May 2007
    Location
    Sweden
    Beans
    84
    Distro
    Kubuntu 7.10 Gutsy Gibbon

    Re: Advice in getting started with Python

    Uhmmm? Well lets put it this way.

    Python is a language. Such as say English. You dont 'run' Python. As you dont run English. It is a bridge between you and the computer as English is a bridge between you and me. Here is how it works:

    You write a textfile containg your python code using a editor such as gedit or geany. You then tell the python interpreter to run your file. This can be done in the terminal by typing "python mypythonfile". The python interpreter will then Tell the computer to do exactly what you have told it to do in the text file.

    So lets do this from the begining.
    Open Gedit.
    Crate a new file in your homedir you call hello.py
    In this file you write the following.

    Code:
    #/usr/bin/env python
    # coding: UTF-8
    
    print "Hello from python"
    Now save the file.

    Now you open a terminal and type:
    Code:
    python hello.py
    Last edited by Smygis; October 26th, 2008 at 01:51 AM.

  2. #12
    Join Date
    Apr 2007
    Beans
    14,781

    Re: Advice in getting started with Python

    Quote Originally Posted by Smygis View Post
    Code:
    #/usr/bin/env python
    # coding: UTF-8
    
    print "Hello from python"
    Now save the file.

    Now you open a terminal and type:
    Code:
    python hello.py
    That works, although the first two lines aren't needed.

    If you mark the file as executable, the first line will tell the shell how to run it. The second line will tell the interpreter to use unicode.

    You could have just done:

    Code:
    print "Hello world"
    And run it with python manually.

  3. #13
    Join Date
    May 2007
    Location
    Sweden
    Beans
    84
    Distro
    Kubuntu 7.10 Gutsy Gibbon

    Re: Advice in getting started with Python

    When i first did try python i didn't need them ether. Or so they said.
    And then i wrote my hello world in Swedish "Hallå Världen". And python spat an error in my face. thank you very much.

    And since then my opinion is that they should always be there no mater what.
    Last edited by Smygis; October 26th, 2008 at 02:00 AM.

  4. #14
    Join Date
    Apr 2007
    Beans
    14,781

    Re: Advice in getting started with Python

    Quote Originally Posted by LaRoza View Post
    If you mark the file as executable, the first line will tell the shell how to run it. The second line will tell the interpreter to use unicode.
    Quote Originally Posted by Smygis View Post
    When i first did try python i didn't need them ether. Or so they said.
    And then i wrote my hello world in Swedish "Hallå Världen". And python spat an error in my face. thank you very much.
    So? I didn't say they were never needed, just that they weren't needed in that post.

    "Hello world" doesn't require unicode, so without an explanation, it adds un-needed complexity, and the shebang isn't used in your example, and is equally unexplained.

  5. #15
    Join Date
    Sep 2008
    Beans
    65

    Re: Advice in getting started with Python

    Quote Originally Posted by LaRoza View Post
    You don't need the multi hundred dollar IDE to program (and you'd be restricted to Windows). You don't need the "free" versions, called "Express" that are crippled and designed to get you hooked on them so you end up buying the full versions.
    Just for the record, Visual C# 2008 Express Edition isn't crippled at all. And now that Mono 2.0 supports Windows.Forms among others, it means that you can create a C# app in Windows and run it in Ubuntu or any other distro that has Mono installed (and vice versa). The only restriction is that you can program only in C#.

  6. #16
    Join Date
    May 2007
    Location
    Sweden
    Beans
    84
    Distro
    Kubuntu 7.10 Gutsy Gibbon

    Re: Advice in getting started with Python

    Quote Originally Posted by LaRoza View Post
    So? I didn't say they were never needed, just that they weren't needed in that post.

    "Hello world" doesn't require unicode, so without an explanation, it adds un-needed complexity, and the shebang isn't used in your example, and is equally unexplained.
    Well then. Explain to the guy here how he connects his exavangizmodode to his trapeziums and point to a wiki that will tell him how to squeeze orangejuice out of his GPU.

    If someone bother to read between his lines you would have realized he does not even know what a programming language is. Or what an IDE is.

    If he asked what the shebang line and coding declaration is i would have told him.
    Last edited by Smygis; October 26th, 2008 at 02:26 AM.

  7. #17
    Join Date
    Apr 2007
    Beans
    14,781

    Re: Advice in getting started with Python

    Quote Originally Posted by Smygis View Post
    If someone bother to read between his lines you would have realized he dose not even know what a programming language is. Or what an IDE is.
    I am not good at reading between the lines.

    If he asked what the shebang line and coding declaration is i would have told him.
    Why do you have such a problem with me informing? You posted an example, so I explained it for the OP's benefit.

  8. #18
    Join Date
    Apr 2007
    Beans
    14,781

    Re: Advice in getting started with Python

    Quote Originally Posted by gomputor View Post
    Just for the record, Visual C# 2008 Express Edition isn't crippled at all....The only restriction is that you can program only in C#.
    That is crippled.

  9. #19
    Join Date
    Sep 2008
    Beans
    65

    Re: Advice in getting started with Python

    Quote Originally Posted by LaRoza View Post
    That is crippled.
    The IDE is called Visual C# 2008 Express Edition.
    C#, it's for C#, you know that. How can an IDE for a specific language can be crippled? Because it doesn't support any other languages? But it's for C# only, it says it on the title. Is IDLE crippled because I can't edit or run any Ruby scripts from there? I don't think so!

  10. #20
    Join Date
    May 2007
    Location
    Sweden
    Beans
    84
    Distro
    Kubuntu 7.10 Gutsy Gibbon

    Re: Advice in getting started with Python

    Quote Originally Posted by LaRoza View Post
    Why do you have such a problem with me informing? You posted an example, so I explained it for the OP's benefit.
    I don't have a problem with clarification being made upon my posts.
    What i have a problem with is this sentence: "That works, although the first two lines aren't needed". The first two lines are definitely needed, only not in my example.

    You are making it sound like it is something that will never ever be of any use and i only put it there to seem l33t.

    Quote Originally Posted by gomputor View Post
    The IDE is called Visual C# 2008 Express Edition.
    C#, it's for C#, you know that. How can an IDE for a specific language can be crippled? Because it doesn't support any other languages? But it's for C# only, it says it on the title. Is IDLE crippled because I can't edit or run any Ruby scripts from there? I don't think so!
    It may not be crippled but it still is retarded.
    Last edited by Smygis; October 26th, 2008 at 02:38 AM.

Page 2 of 5 FirstFirst 1234 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •