Starting out with Python programming

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
sarakay
Posts: 26
Joined: Sat 22 Aug 2009, 17:48

Starting out with Python programming

#1 Post by sarakay »

An app that I wanted to run required Python, so I downloaded and installed the following pets:

python-2.5.2.pet
libdb-4.4.pet
pycairo-1.4.12.pet
pygobject-2.14.1.pet
pygkt-2.12.pet
TclTk-patched4py-8.4.pet

So now that I have these, I'm thinking, why not dabble in a little Python? Just wondering if I have most of what I need to get started. (Not sure whether the libdb pet is required for Python or just for the application.)

Thanks!
Sara

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#2 Post by disciple »

why not dabble in a little Python?
Only because you want to make something generally useful to the Puppy community :), in which case you would try Genie instead.
Just wondering if I have most of what I need to get started.
Yes, you have what you need to create simple applications with python and pygtk, and all those other things. The trouble with Python is just that most programs use all sorts of extra libraries and bindings that you need to install to use them.
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#3 Post by Lobster »

Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

sarakay
Posts: 26
Joined: Sat 22 Aug 2009, 17:48

#4 Post by sarakay »

Thanks for your replies, disciple and Lobster.

Could I ask a couple more questions? I have a lot of experience with procedural languages - assembler, COBOL, Basic (yes, I know), and a little bit of C, but I am a complete newbie to object oriented programming. Would Genie be good to learn OOP? Do you guys know of a good tutorial or book for learning OOP concepts?

I found some books on Amazon that teach OOP using C++. Would it be better to learn C++ first and then go on to Genie?

Sara

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#5 Post by Lobster »

Would it be better to learn C++ first and then go on to Genie?
You are still thinking procedurally
Do both :wink:
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

caleb72
Posts: 57
Joined: Fri 15 May 2009, 12:44

#6 Post by caleb72 »

I taught myself OO by using Smalltalk, I have many books that I collected on Smalltalk in that time.

But I found Python was a wonderfully forgiving teacher of OO especially as you can freely blend procedural with OO. Personally, I think the ability to do both in one development tool is the best of both worlds.

The reason I think Python might be a better start to learning OO is that Genie is pretty fresh/raw right now - not much good documentation, limited examples. Whereas Python not only has huge piles of documentation on the subject, it also has a wonderful interactive interpreter that allows you to tap out and test all sorts of constructions as you're learning without going through the whole source file, compile business.

If you can become comfortable with the white-space sensitive Python, it will also make a smoother transition to Genie.

This is just the perspective of a mediocre hobby programmer and I never went down the Jave, C#, C++ route so that's a whole experience that I can't balance against the route that I took, so take my ramblings with a grain of salt.

Regards
Caleb

ITAmember
Posts: 167
Joined: Sun 13 Sep 2009, 18:50
Location: The middle of a cornfield

#7 Post by ITAmember »

Python really is a fantastic language and you should do your best to learn it, despite what some other python haters say. When you become proficient with it I recommend learning vala which should be reasonably mature by the time you learn Python. I personally don't like genie as it's a hybrid of C++ and Python syntax which leads to rather strange abomination. If genie was to be less C++ and more Python it would be much nicer.

sarakay
Posts: 26
Joined: Sat 22 Aug 2009, 17:48

#8 Post by sarakay »

Thanks guys. It seems that the big advantage to Python is that there's lots of help available in the form of tutorials, books, forums etc. So it makes sense to start there, and apply that knowledge later on to Vala and Genie. I'm all set with a Python sfs (learned how to make one out of a pet today! My newbie-self is so proud!) and a tutorial so with any luck will be able to get beyond "Hello, world!" soon.

Lobster said:
You are still thinking procedurally
(Sigh.) What can I say? I'm one of those people who organizes grocery lists by store aisle to increase efficiency. Object oriented programming may be a huge challenge.

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#9 Post by Lobster »

My newbie-self is so proud!
:)
You have made a good choice.
Good luck.

Even though I finally understand why object orientated programming is clever, I still can not make use of it (that would take real skill).

It is something like this.
Imagine a procedure that was designed to
work across a range of potentaial calls
The ability to recognise patterns would enabe it to recognise patterns
in sound, voice and a database of saved files.
In effect one procedure is doing 3 very different things.
The thread can be used simultaneously.

Efficient and cool if you can create such a procedure . . .
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

Minnesota
Posts: 326
Joined: Thu 11 Sep 2008, 11:25

VB

#10 Post by Minnesota »

I have a question... I used to teach vb5 and vb6... yes from the other folks...of course a very oo language, frankly seemed easy to learn and use once you understand it is more or less an interrup or focus language. "Basic" in the background.

Is Python anywhere similar? I would like to do some programming in Puppy.. have followed the various suggestions for several years, downloaded some of the documentation.. still have not dropped my feet into the waters. Have done a ton of programming systems with Access and vb in the background... are we talking about any similar capabilities?

I really don't at my age, want to bit twiddle... and learn complex syntax.

Thanks,

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#11 Post by Lobster »

You could try out the pets for Python here:
http://www.murga-linux.com/puppy/viewto ... 618#358618

Python syntax should be easy enough.
However Python requires 30MB of support files to run.
Those support files are not in Puppy.
Genie is the nearest equivalent.

Gambas may suit you and apparently the support run time file required is
about 250k and Gposil has flirted with making this available for
Dpup (the run time not the complete Gambas) :)
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

ITAmember
Posts: 167
Joined: Sun 13 Sep 2009, 18:50
Location: The middle of a cornfield

#12 Post by ITAmember »

@minnesota

Python bears some resemblance to basic on the syntax level but the inner workings are very different. I do think you will find yourself presently surprised with the power of Python however.



A few definitions...

Procedural: executing statements in a linear nature. (lots of variable assignments)
OOP: a way of abstracting and encapsulating procedures. (invaluable on large projects)
Functional: the entire program is made of nested expressions. Very few variable assignments. None of the languages discussed thus far are functional btw.

edexter
Posts: 8
Joined: Wed 25 Nov 2009, 16:46

#13 Post by edexter »

hopefully this isn't to late to be useful. I use python alot on windows and will probably see what wine would do to the windows version first. On your list you probably want wxpython it is very useful and you will want pygame (sdl). it is possible pygame will not work on some older laptop graphics cards.

you might try pysh a shell with python embeded in it, I was going to add that as one of my very first items to my setup.

Post Reply