views:

168

answers:

4

I have a project idea, but unsure if using Python would be a good idea.

Firstly, I'm a C++ and C# developer with some SQL experience. My day job is C++. I have a project idea i'd like to create and was considering developing it in a language I don't know. Python seems to be popular and has piqued my interests. I definitely use OOP in programming and I understand Python would work fine with that style. I could be way off on this, I've only read small bits and pieces about the language.

The project won't be public or anything, just purely something of my own creation do dabble in at home.

So the project would essentially represent a simple game idea I have. The game would consist roughly these things:

  • Data structures to hold specific information (would be strongly typed).
  • A way to output the gamestate for the players. This is completely up in the air, it can be graphical or text based, I don't really care at this point.
  • A way to save off game data for the players in something like a database or file system.
  • A relatively easy way for me to input information and a 'GO' button which processes the changes and obviously creates a new gamestate.
  • The game would function similar to a board game.

Really nothing out of the ordinary when I look back at that list. Would this be a fun way to learn Python or should I select another language?

+7  A: 

I find that the best way to learn a new language is by doing something like this (small project of your own). Python is no different.

Everything you wrote can be done in Python, so I can't find any reason not to use it, if you want to learn.

del-boy
Can you comment on it's display capabilities? I mean can I create a form like in C#?
Robb
There are a number of GUI frameworks you can use to build form.http://wiki.python.org/moin/GuiProgramming
unholysampler
I am not a C# developer, but sure you can create forms (or any other kind of GUI) in python. If you want to "drag'n'drop" GUI elements, I don't know any tool that can compete with Visual Studio for python (for any GUI library). My recomendation for GUI in python is wxpython, but you should check out PyQt, PyGTK, tkinter too.
del-boy
@Robb: Python comes with a relatively simple GUI toolkit called Tkinter. It should be fine for your needs. However, there are several other good options including wxPython and PyQt. You will not have to skimp on the display.
John Y
+1  A: 

Well, if you do C++/C#, I'd say go for it - I personally love C++ because it is (in my opinion) self-intuitive and easy. The 'grammar' of Python doesn't make much sense. Plus, if you already know another language, why learn Python for fun? I mean, if you want to create a simple project for fun, it's really not worth it, and you'll end up working for several weeks at least, before you can begin your game. So yeah, you should definitely use C++.

However, if you're just trying to learn a new language, there's nothing wrong with that; Python certainly is pretty popular. Javascript is pretty easy as well, as it uses automatic inference and all that jazz.

Elliot Bonneville
I strongly suggest that you learn another language or five before being credible in such claims. C++ is intuitive to you because you know it, as a language it is such a pile of hacks that even its creator is somewhat critical of what it has become. In an absolute sense, the Python grammar is quite simple. Indeed, it is not familiar to you as C++ apparently is, but that just makes it unknown to you, not complex. With literally dozens of languages under my belt, I am finding learning Python challenging because it requires a different manner of thought.
msw
That's correct. However, you must be aware that almost all operating systems today are written in C++ or one of its relatives, C#, C, well, you get the point.
Elliot Bonneville
+5  A: 

Python seems very suitable to your purposes (e.g., pygame and other popular third party extensions make it easy to achieve nice graphics, and you can also choose curses for structured textual I/O, etc) with the single exception of what you probably mean by "strongly typed".

Python is strongly typed (there is no way you can erroneously use a string for an operation for which an integer is required, and vice versa, for example), but it's dynamic strong typing: each object has a strong type, but names (in the wide sense, including barenames, compound names, items in containers, ...) do not have types -- each name refers to an object, the object has the type, not the name. You can rebind the name to a different object, and that object may have a different (strong;-) type than whatever object was previously bound to that same name.

Dynamic languages all have this character, even though many go further than Python in "type laxity" ("confusing" strings and numbers, and different kinds of numbers, while Python distinguishes strings from integers from floating-point numbers, for example) -- Python is quite "type-picky"... in the dynamic sense where names, per se, have no types, though;-).

Alex Martelli
+1 Alex thank you for that break down of strongly typed and dynamic strong typing. I guess that is something that I'd learn huh...
Robb
+3  A: 

I've already voted for del-boy's answer, but I would like to go further and say that if your goals are to (1) have fun, (2) learn a new language, and (3) write your own game, then Python is a slam-dunk, no-brainer, awesome choice to achieve all three.

The language excels at all the things you seem to be looking for (see Alex Martelli's answer for the caveat on strong typing), and in my opinion is not much of a "stretch" from the C family of languages (I think you will find most things simply easier, rather than strange), compared to other good languages such as Ruby or Lua.

John Y