Sign in to follow this  

Is Python a good place to start?

This topic is 4269 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Quote:
Original post by Huffer
Now the main question: is Python a good way to "start"? I'm not really talking about game programming alone, but general programming.


I think so.

Quote:
Any tips on where should I start?


"Begin at the beginning," the King said gravely, "and go on till you come to the end: then stop."


Quote:
And *WHAT* should I actually write?


You said you want to do some general programming. Isn't there a program you would find useful? A tool you need?

Write it.

Share this post


Link to post
Share on other sites
Oh... I'm still thinking about it. Maybe I should just learn C++? It is the number 1 language and will be in the near future. Do you really recommend Python? I mean, I like it, and a lot of people do, but all around me I see C++... Please help.

Share this post


Link to post
Share on other sites
I was going to learn Python or something like it, but I came to the same conclusion as you: a C-type language is the way to go. I am learning C# right now. Python is still a good language, but if you want a game development job someday C/C++/C# is probably the best. Just my opinion!


--BlackViper91--

Share this post


Link to post
Share on other sites
Quote:
Oh... I'm still thinking about it. Maybe I should just learn C++? It is the number 1 language and will be in the near future. Do you really recommend Python? I mean, I like it, and a lot of people do, but all around me I see C++... Please help.


As a beginner you don't need to worry about what language you may be using eventually, but rather the language that can help you learn the fundamentals of programming now. Python will be a lot better at this task than C++. If you want to start off with a C-style language then take a look at C# though I don't really see any reason to if you like Python.

Once you're a competent programmer you should be able to pick up a new language in a short amount of time with relative ease anyway.

Share this post


Link to post
Share on other sites
In my experience, I think it's better to develop a "programmers" state of mind. Learning how to develop an algorithm, how to structure a program, etc. before learning a particular language. Python is an excellent language to do this in, I believe, because you don't have to worry about lower level things like how large a particular data type is. Also, you don't have to recompile every time you alter and experiment with your program (which when you are learning to program, you should be altering and experimenting a lot).

Share this post


Link to post
Share on other sites
I guess. Even though, as I said, I do have some experience and I do know some C++ and C#, and I believe I have a very good understanding of OOP in particular. However, just like you put it, I don't have a "programmer's state of mind" yet so I guess a well-designed language like Python is the way to go so Python it is :) As for C#, it's actually my favourite language of all I'd learnt, but I simply don't believe in this .NET Microsoft thing. Nothing should be tied and limited so much. Although I guess people wouldn't care if they need to write a basic (not simple) GUI app like Word (what I mean by "basic" is that it's a plain Windows app). But C# is more like a companion language to me, so once I know all the big boys (well, C++ anyway) and will need to write a Windows GUI app, and .NET will be popular - I'll use C#.

A follow-up question, if I can: is there anything like SDL for Python? I mean, a "simple" 2D framework? I don't need 3D yet, whereas 2D is a good way to go. Thanks in advance!

Share this post


Link to post
Share on other sites
Quote:
Original post by smr
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.

The first alpha version of Python 2.5 came out today. ++rating to Python developers.

Share this post


Link to post
Share on other sites
Win32 users should stay on 2.4 until extension modules get built for 2.5, unless they are comfortable with doing it themselves. In my case, I have ctypes, matplotlib, Numeric, numpy, pgu, PIL, psyco, pygame, pywin32, scipy and wxpython installed, and I don't have time right now to rebuild and re-test with my app under 2.5.

Share this post


Link to post
Share on other sites

This topic is 4269 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this