• Lucid Dreaming - Dream Views




    Results 1 to 10 of 10
    1. #1
      DuB
      DuB is offline
      Distinct among snowflakes DuB's Avatar
      Join Date
      Sep 2005
      Gender
      Posts
      2,399
      Likes
      362

      Tell me about Python

      So over the summer I am going to have to teach myself the basics of Python for the lab that I'll be working in. We're going to be doing experiments involving subliminally presented stimuli (20-40 milliseconds), evaluations of pictures and movie/audio clips, and possibly recording reaction time data, as well as asking subjects basic questions - all GUI, obviously. I have programming experience with Java and C++ (I guess that's how I got stuck with this gig) but I don't know much at all about Python.
      • Do you know of any good books for learning Python?
      • Any good online resources?
      • Any tips on using Python specifically to do the things that I listed above?
      • Any other things that I should know about Python and/or learning Python?
      Any information would be appreciated. Thanks, guys.

    2. #2
      Banned
      Join Date
      Apr 2007
      Location
      Out Chasing Rabbits
      Posts
      15,193
      Likes
      935
      Things to keep in mind:

      It uses a JIT compiler, so it may speed up and slow down randomly, so use the hardware timer for timing things.

      It is the only programming language that I know of that is indentation sensitive. That can be very annoying, but makes code easier to read.

      It's a very simple language, no direct access, nor does it have any objects. Most people consider it a scripting language more than a real programming language.

    3. #3
      adversary RedfishBluefish's Avatar
      Join Date
      Apr 2007
      Location
      Now
      Posts
      495
      Likes
      4
      Python doesn't use a JIT...??? (As far as I know apart from the PyPy project)
      I think you are thinking of the wrong language, ninja9578.
      It is indentation sensitive, yes, but see:
      Code:
      >>> class A:
      ...    def __init__(self, x):
      ...         self.x = x
      ... 
      >>> a = A(16)
      >>> a.x
      16
      Python is strongly object oriented.

      Also, http://docs.python.org/tutorial/.

    4. #4
      What's up <span class='glow_006400'>[SomeGuy]</span>'s Avatar
      Join Date
      Nov 2007
      LD Count
      About 1
      Gender
      Location
      Tmux on Debian
      Posts
      2,862
      Likes
      130
      DJ Entries
      4
      Python is very powerful, from what I've read. But, you have to be a super-indent/space nazi because of the lack of braces.

      It shouldn't be too hard...There are good books on it out there. I have one, forgot the name. Also, that link above is where I go the basics of it.

      I never got too far into it, I put it aside for C++ and Perl, the latter of which I am currently working on learning. However, GUI programming with Python is supposed to be pretty easy.

      Hey guys, I'm back. Feels good man
      ---------------------------------------------------
      WTF|Jesus lul
      spam removed

    5. #5
      dsr
      dsr is offline
      我是老外,可是我會說一點中文。
      Join Date
      Nov 2006
      Gender
      Location
      my mind
      Posts
      374
      Likes
      1
      The indentation is a non-issue. You indent the same way you would for other imperative languages. Python just ensures that other programmers you're working with don't mis-indent a line by accident. I second the official tutorial. Python's a great language for a lot of tasks (anywhere from simple scripts to larger CLI apps to GUI apps to CGI scripts to web applications to games, etc.), and it has a really compact language definition, making it easy to keep in your head (contrast with C++ and Perl). It also has one of the easiest-to-read syntaxes of any imperative language, and Python code tends to be really concise, saving tons of development time.

    6. #6
      What's up <span class='glow_006400'>[SomeGuy]</span>'s Avatar
      Join Date
      Nov 2007
      LD Count
      About 1
      Gender
      Location
      Tmux on Debian
      Posts
      2,862
      Likes
      130
      DJ Entries
      4
      ^ The indentation is a nuisance however. Learning that before {} programming doesn't seem the way to go with me. I have only seen one language use that indenting style, and that's Python. i'm sure there are more, less known languages with that style, but for mainstream programming, {} seems better to me.

      Hey guys, I'm back. Feels good man
      ---------------------------------------------------
      WTF|Jesus lul
      spam removed

    7. #7
      dsr
      dsr is offline
      我是老外,可是我會說一點中文。
      Join Date
      Nov 2006
      Gender
      Location
      my mind
      Posts
      374
      Likes
      1
      Haskell syntax also recognizes indentation, although it's syntactic sugar for braces iirc. Python and Haskell are two of the most efficient programming languages, in terms of productivity as opposed to performance (although Haskell code compiled with `ghc -O2' isn't much slower than the equivalent imperative code written in C), and they both ascribe syntactical meaning to whitespace.

    8. #8
      Banned
      Join Date
      Apr 2007
      Location
      Out Chasing Rabbits
      Posts
      15,193
      Likes
      935
      That's why I like C++, the productivity of a powerful OOP language and the raw speed of C and inline assembly

      Just out of curiosity, does Python have inline assembly capabilities. No optimizing compiler will ever beat a skilled assembly programmer.

    9. #9
      adversary RedfishBluefish's Avatar
      Join Date
      Apr 2007
      Location
      Now
      Posts
      495
      Likes
      4
      Well, you can write a C extension module and use assembly in that... I doubt it has inline assembly, that would just tempt people to write illegible assembly in the middle of their code - negating the clarity of code that is one of python's goals . A maxim of python development is "write it in python first, if it is too slow then write an extension module in C".

    10. #10
      What's up <span class='glow_006400'>[SomeGuy]</span>'s Avatar
      Join Date
      Nov 2007
      LD Count
      About 1
      Gender
      Location
      Tmux on Debian
      Posts
      2,862
      Likes
      130
      DJ Entries
      4
      C + Python is a good way to go.

      Hey guys, I'm back. Feels good man
      ---------------------------------------------------
      WTF|Jesus lul
      spam removed

    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
    •