Is Python a good place to start?

Started by
18 comments, last by Fruny 18 years ago
Basically, I have basic knowledge of C++, C#, PHP, OOP techniques (quite good, actually), but my problem is I haven't really done anything in any of those languages and have only basic (well, I know all the bits but not in detail, so I know loops, structs and stuff like that but can't really use them well) knowledge. Then I have dumped programming altogether. Now I wanna "come back" and all of a sudden Python looks like an amazing language (a year ago I hated it). Now the main question: is Python a good way to "start"? I'm not really talking about game programming alone, but general programming. It seems really well-structured, has a lot of good stuff about it and supports a lot of stuff like GTK and SDL. Besides, it's the result that matters to the end-user, not the programming itself. So is Python a good language? OR should I continue to dig into C++, C# or whatever else? Mind you, I can't say I have any particular problems with any of thos languages, I just didn't dig enough, I guess. Thanks!
Advertisement
If you like Python, then use Python. It's a perfectly good language for many things. Though if you need high performance you'll want to look elsewhere.
Python is a great place to start. If it's not already built-in, there's an installable python module for just about anything and everything you'll ever want to do. Plus it's just a great language.
Quote:Original post by Monder
If you like Python, then use Python. It's a perfectly good language for many things. Though if you need high performance you'll want to look elsewhere.


Yes, python is slow. But it is extendable with C and C++. Look into swig and boost::python.

If you're running on X86, you should also look at psyco, a specializing JIT compiler for Python.

Several other things to consider:

1. Python's expresivness will allow easier algorithm level optimization, which is where the big payoff's are - +2x rathern than +20%. That's even a bigger win if you do end up having to recode hotspots in a less dynamic language.

2. *Only* optimize after you measure. If you don't measure, you're going to be wrong. Period. OK, on rare occasion you'll be right, but most of the time you will not. timeit and profiling are your friends.

3. If your code is too slow, and you've measured to find one or more hotspots, and you've tried every algorithmic optimization you can think of or find through research, and you can't use Psyco (or it doesn't give you the speedup you need), consider Pyrex when you recode. It's more or less a subset of Python that allows type defs and automagically handles ref counts for you. It's a good thing.

4. If you find a C library that will do things you need, consider using ctypes to wrap it, as a) it's native Python, and so easier to change later and b) it looks like ctypes will be part of the standard distribution in Python 2.5.

Hope some of this helps. Be sure to start lurking in comp.lang.python if you decide to go with Python. Very friendly, very helpful, much clue.

Hope this is helpful.

[Edited by - sindisil on April 4, 2006 1:27:28 PM]
Thanks for all the help, guys! This is a really great place.

I seriously doubt performance will be an issue for me anytime soo, so Python it is :)

Any tips on where should I start? And *WHAT* should I actually write?
A good place to start would be to write some general tools for the kind of development you plan on doing. Try adapting a tilemap engine from Phil's PyGame Utilities and look through the source code.
Quote:Original post by sindisil

4. If you find a C library that will do things you need, consider using ctypes to wrap it, as a) it's native Python, and so easier to change later and b) it looks like ctypes will be part of the standard distribution in Python 2.5.


Thanks! This is so much easer than using swig. ++rating to you.

I mean, I've got all these books which are good but their examples (and the chapters themselves) are based only on console examples. And consoles are pretty useless nowdays. So what should I do myself? Maybe start learning GTK already?
If you like python and want the .NET framework's goodness, you might want to look at IronPython too.

Quote:I mean, I've got all these books which are good but their examples (and the chapters themselves) are based only on console examples. And consoles are pretty useless nowdays. So what should I do myself? Maybe start learning GTK already?


The UI is a very small part of every program. Games, of course, are a major exception, but even then, there's a lot to learn by doing console program. UI code is also mostly tedious and uninteresting to write. It's about using a framework as opposed to solving a problem.
I teleported home one night; With Ron and Sid and Meg; Ron stole Meggie's heart away; And I got Sydney's leg. <> I'm blogging, emo style

This topic is closed to new replies.

Advertisement