Python ?s
  • User avatar
    orion
    super8 member
    Posts: 153
    Joined: Thu Aug 18, 2011 12:29 am
    Location: austin
    Contact:

    Python ?s

    by orion » Thu Jun 13, 2013 10:12 pm

    I'm not a python expert, probably not even a novice, but I can cut and paste like a pro :) I'm attempting to teach myself python, at least enough to be able to read it and understand the modul8 manual :shock: (which i should re-read) . I was sifting through some modules and saw some syntax that I haven't seen before and then I started wondering, is this python 2.7.2 or python3? I thought about homebrewing in python3 but I wanted to ask if it'll will mess up anything in modul8 if I have both versions of python running? Also, is there an advantage to having python3 installed or am I good with 2.7.2?

    Also, import, how do i see a list of things i can import? I see math, copy, urllib, random, time, os, datetime, webbrowser, etc. in other peoples modules, where are you guys finding these.
    After said import, there's usually a 'from (x) import (y)' y being parameters of x. How do I view those options as well? I'm guessing maybe the libraries are plentiful and it's better to know what you're looking for than to see a list of all the libraries? I think I read somewhere that python has a library for just about everything so let me know if i'm wasting my time.

    Not sure if this is the best forum for python questions but I only care to learn python for use with modul8 so I figured...
  • User avatar
    sigmasix
    master
    Posts: 1222
    Joined: Thu Dec 02, 2004 2:12 pm
    Location: gva | switzerland
    Contact:

    Re: Python ?s

    by sigmasix » Fri Jun 14, 2013 2:33 pm

    Modul8 is using python 2.6 if I'm not mistaking, so no need to get python3, you won't be able to use it from within modul8.

    For the libs, you better know what you want to do and then find the way to do it using your good friend google. If you need to use a lib, you'll find that info. The other way round is strange, it would mean that you'll make a module that does something just because you found a lib that does that?!
  • User avatar
    orion
    super8 member
    Posts: 153
    Joined: Thu Aug 18, 2011 12:29 am
    Location: austin
    Contact:

    Re: Python ?s

    by orion » Fri Jun 14, 2013 10:17 pm

    thank you sigmasix. I was hoping that I could find a list of library's and then figure out what they do but from what i'm reading and from what you say i'm going to need to have a better understanding of python and what it can do.

    I was talking with a friend who codes in c++ for a living and he says that it's good to start with a clear objective, that computer programming is an exercise in breaking down your objective into a series of instructions. Something that i'm not very familiar with but that i'm trying to learn and understand.

    I'm using the youtube and the google to find out more information on python but if you or anyone else knows of some good resources to help me better understand python that would be greatly appreciated. :D
  • anomad
    master
    Posts: 412
    Joined: Sun Oct 21, 2007 10:07 pm
    Location: north cakalacky, usa
    Contact:

    Re: Python ?s

    by anomad » Sat Jun 15, 2013 4:42 am

    orion wrote:I'm not a python expert, probably not even a novice, but I can cut and paste like a pro :)


    . that's the first step! :)

    . regarding your other questions....

    . how do you know which modules are available? i try to import them and see if i get an error

    . normally in python you can type

    help('modules')

    . (to try this, on your Mac, go to 'Utilities/Terminal '. when you have a command prompt, type python and press return. then type help('modules') to see what's install on your default python installation )

    . to see what you have available. unfortunately, if you put that command in Init() in modul8, you'll get an error

    File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site.py", line 348, in __call__

    . so, you don't know the modules, but you can see modul8 v2.7 is using python 2.5

    . regarding import (x) from (y) - all that's saying is don't import all the functions from (y) - just (x). this is usually done when a library has several functions you don't need so there's no use in loading everything in (x).

    . good luck and keep asking questions... there's something very satisfying about going above and beyond the 'original programming' of modul8 and creating something truly unique !

    -james
    (a nomad. )

Who is online

Users browsing this forum: No registered users and 1 guest