views:

362

answers:

8

I'm a hobbyist programmer (only in TI-Basic before now), and after much, much, much debating with myself, I've decided to learn Python. I don't have a ton of free time to teach myself a hundred languages and all programming I do will be for personal use or for distributing to people who need them, so I decided that I needed one good, strong language to be good at. My questions:

  1. Is python powerful enough to handle most things that a typical programmer might do in his off-time? I have in mind things like complex stat generators based on user input for tabletop games, making small games, automate install processes, and build interactive websites, but probably a hundred things along those lines

  2. Does python handle networking tasks fairly well?

  3. Can python source be obfuscated, or is it going to be open-source by nature? The reason I ask this is because if I make something cool and distribute it, I don't want some idiot script kiddie to edit his own name in and say he wrote it

  4. And how popular is python, compared to other languages. Ideally, my language would be good and useful with help found online without extreme difficulty, but not so common that every idiot with computer knows python. I like the idea of knowing a slightly obscure language.

Thanks a ton for any help you can provide.

+14  A: 

Is python powerful enough to handle most things?

Yes. Period. Study EveOnline game for more information. Look at pygame framework. Free free to use Google to find more.

Does python handle networking tasks fairly well?

Yes. Look at the number of Python web frameworks plus the Twisted framework. Feel free to use Google to search for Python networking.

Can python source be obfuscated?

Not usefully. This isn't C.

And how popular is python, compared to other languages?

Look at the TIOBE index.

S.Lott
Can't be obfuscated? Check out this chat server http://paste.pocoo.org/show/94512/ (written by http://stackoverflow.com/users/10999/)! (The question, of course, about trying to hide the source code to keep an app from being stolen showed a lack of knowledge about what keeps code from being unfairly taken in any language.)
Mike Graham
+6  A: 

I think that Python is very powerful to do a lot of things, but just like Java and C++, it often depends on good third-party libraries. I come from a Java background but use Python for a lot of things, and it's been a fun ride. I've done things like statistics, and automation, not sure about the UI though that often depends on the toolkit more than the language.

Python networking works well. I don't know if I'd use it to build a fast algorithmic trading system or a VOIP application, but for most intents and purposes, especially at higher levels of abstraction, it's fine and easy to use. You would need external libraries for things like SSH or FTP.

Python is quite popular and has very good online support, active community, and major corporations (likeGoogle) that use it. I found the official online tutorial and reference to be excellent.

I have to say that I disagree with the "every idiot with a computer" line. There's a difference between knowing a language and using it right, and that's true about every language, even natural ones :) Python does have a lot of functional elements that are not as trivial to use for people coming from a procedural background, so there's always room for growth.

The one problem with Python compared to languages like C and Java is that it is not statically typed. This makes it much faster to write code, but also makes it *much easier) to make mistakes that can be quite nasty to debug. For instance, the same variable can contain a String reference at some point, and a reference to a list of strings at some other point.

Uri
+1 for defending Python for "non-idiot" programmers. As a lover of Haskell (fitting Matt's criteria for a slightly obscure language) I still go to Python frequently for many tasks; it is in no way "below" anyone.
Jared Updike
+2  A: 
  1. Probably yes. Maybe the stat crunching thing will be kinda slow, and maybe a game depending on what kind of game, but generally the performance is good enough, and you save a lot of time on the actual programming. If you REALLY need performance, you can make a module in C, but usually there is a library written to do what you want..

  2. I haven't used it, but there's a framework called Twisted that seems to be pretty good.

  3. No. Bytecode can be decompiled easily, and it only works on a specific version of Python, so your code isn't as portable.

  4. Python is pretty popular, and the Python Package Index has a big list of third party libraries. It's not as widespread as, say, Java, but a lot of people use it and you can probably get answers for what you want.

Javier Badia
Python has libraries like SciPy and NumPy for anything performance critical, numerical, statistical, etc. Short of image processing (which is handled reasonably well by PIL (Python Imaging Library)) or intense graphics stuff, I can't think of anything I've had performance issues with using Python.
Jared Updike
CPython bytecode is fairly easily decompiled, often to rather nice, readable code (if the code was to start out with). It also has several limitations, including limiting to running on one Python version and not working with alternate implementations of Python. What protects you from having someone unfairly use your code is the law and the fact that most people aren't jerks.
Mike Graham
Thanks for the input, I've modified the answer. Not that it matters a lot at this stage.
Javier Badia
+4  A: 
  1. Absolutely.
  2. What type of networking? It has socket, http, xml, smtp/pop, telnet, and much more built in.
  3. Python obfuscation won't be nearly as good as a compiled language. Usually that isn't a problem.
  4. It's the 9th most popular tag on stackoverflow, so there's plenty of help available.
Jon-Eric
+3  A: 

Is python powerful enough to handle most things that a typical programmer might do in his off-time? I have in mind things like complex stat generators based on user input for tabletop games, making small games, automate install processes, and build interactive websites, but probably a hundred things along those lines

Definitely. Python is a good tool for all of those except automating install processes, where it might be the right tool but more likely the right tool will likely be decided by what specifically you are automating.

Does python handle networking tasks fairly well?

Yes. You will want to look into Twisted.

Can python source be obfuscated, or is it going to be open-source by nature? The reason I ask this is because if I make something cool and distribute it, I don't want some idiot script kiddie to edit his own name in and say he wrote it

"Open source" refers to the licensing of your code, not the viewability of its source code. Hiding Python source code isn't especially possible, and the results of decompiling Python bytecode will result in much more readable code than the equivalent tools in languages like C. Don't worry about this! You can't prevent people from stealing your car or your computer if they are willing to break the law, and you can't do the same for your code in any language.

And how popular is python, compared to other languages. Ideally, my language would be good and useful with help found online without extreme difficulty, but not so common that every idiot with computer knows python. I like the idea of knowing a slightly obscure language.

This is an unanswerable question. Google will give you lots of conflicting results with different metrics, most of them useful. You're also being a bit silly ;)


As far as learning materials go, I recommend How to Think Like a Computer Scientist, which is a good text that does not presume any existing programming knowledge. It is available for free online, or you could buy a print copy if you prefer. (Don't bother learning 3.x yet. There is not enough library support to do much useful stuff like you want to do, and when there is picking it up will be a breeze; it's not very different than 2.5/6/7.)

Mike Graham
Oh, twisted is NOT a good place to start. It is a fantastic tool for networking, but a bit of a mind bender for a hobbyist. Heck. It's a bit of a mind bender for professionals. Start with the more straightforward networking modules in the standard libraries. When urllib and urllib2 start to feel cumbersome, download httplib2, which really gets http right, for more complex uses.
jcdyer
@jcd, Twisted can indeed take some effort to click. However, seeing many people's first attempts at their own network apps in Python, I think that it's worth while.
Mike Graham
A: 

Points 1 and 2: HELL YEAH.

Point 4: kind of. Python is good at some network stuff. It's not Java or C++. Just use zlib (zip library) and pickle (serialization) for everything, and look at xmlrpclib if you need IPC.

Point 3: No. However, you can write C modules (for the performance critical, and hard-to-copy) parts of your code, and that would make it non-trivial to reverse-engineer.

wisty
A: 

Live with python and follow your heart !

GentleYang
A: 

Python is up to the task (and better) for 1, 2 and 4.

The best solution for 3 from what you describe would probably be to make your programs really open-source with GPL or BSD like licence. This way people will edit your super-cool sources (but often experienced programmers, not just script kiddies) and build on then but leave your name in for posterity.

kriss