Page 1 of 1

Python ?s

Posted: Thu Jun 13, 2013 10:12 pm
by orion
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...

Re: Python ?s

Posted: Fri Jun 14, 2013 2:33 pm
by sigmasix
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?!

Re: Python ?s

Posted: Fri Jun 14, 2013 10:17 pm
by orion
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

Re: Python ?s

Posted: Sat Jun 15, 2013 4:42 am
by anomad
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. )