Why do I need to learn Python?

Started by
16 comments, last by capn_midnight 19 years, 4 months ago
From what I understand, the Comp Sci classes I am about to take as a part of my Computer Engineering degree are going to be python heavy. I have been doing the C thing for some time now, and I wonder if there is a reason to take the class, or try to test out, like I did for the C++ one. Any of you Comp SCI/ENG students/grads want to throw some advice my way? This is like a fundamental or an intro class to computer science, but it gets lumped in with computer engineering. I tried python for a while, and found it to simple. What can it really do?
HxRender | Cornerstone SDL TutorialsCurrently picking on: Hedos, Programmer One
Advertisement
You couldn't have tried it for very long if you found it too simple... Are you sure that it was simple because you only tried out the initial examples of the language?

Anyway, if your background is primarily C and similar languages, I'd recommend taking it to "broaden your horizons" a bit. If nothing else, learning something different will make you think about the same problems in different ways.

OTOH, if you're not really into programming in general then I'd drop it.
Yes, I am big time into programming. I just checked their website again, and it looks like it can do CGI scripts, which could be fun. Looks easier than creating servlets in java anyways.

I guess I will just take the class.
HxRender | Cornerstone SDL TutorialsCurrently picking on: Hedos, Programmer One
First off, the C/C++ paradigm of heavy, slow-to-code, hyper-optimised languages is only half the computing world, and a rapidly shrinknig half at that. Learning a good RAD admin language is crucial to your skillset, and Python is very good at that. For example, I coded a full cross-platform GUI driven wrapper for Amazon.ca's product system for an assignment over a weekend as my first substantial Python project for school. Meanwhile, it took me that long to code a freaking red-black tree in Java.

Plus, Python will teach you about many aspects of OOP that you don't get in C++ that other real, optimized languages like Lisp and Dylan have, for example closures, generators, metaclasses, and various other things. C++ really only implements a small subset of the OOP paradigm - inner classes alone (that Java brings to the table) open up whole worlds of possibilities. Python is an "everything and the kitchen sink" language, so you'll come out with a fetish for linguistic design.

Ultimately though, the best part of coding in Python will be playing with its C implementation. Python is an extremely well-documented opensource project, and its a somewhat slow language, so a common thing to do in Python is to code modules or classes in C using the Python C API and accessing them from within the Python interpreter. This lets you really optimize the tight parts in C while you explore the higher logic in Python. Plus, the interfaces from within Python are the same for C and Python, so you can easily code a module in Python and then, when you're settled with it, re-implement it in C for the efficiency benefit.
-- Single player is masturbation.
Quote:Original post by kordova
You couldn't have tried it for very long if you found it too simple... Are you sure that it was simple because you only tried out the initial examples of the language?

Anyway, if your background is primarily C and similar languages, I'd recommend taking it to "broaden your horizons" a bit. If nothing else, learning something different will make you think about the same problems in different ways.

OTOH, if you're not really into programming in general then I'd drop it.


Well, for server scripts most people use a special Python based all-in-one webserver/scripting language/database solution called Zope. Again, this is a reflection of Python's "Batteries Included" paradigm.
-- Single player is masturbation.
Quote:Original post by Pxtl
Ultimately though, the best part of coding in Python will be playing with its C implementation. Python is an extremely well-documented opensource project, and its a somewhat slow language, so a common thing to do in Python is to code modules or classes in C using the Python C API and accessing them from within the Python interpreter. This lets you really optimize the tight parts in C while you explore the higher logic in Python. Plus, the interfaces from within Python are the same for C and Python, so you can easily code a module in Python and then, when you're settled with it, re-implement it in C for the efficiency benefit.
You forgot about Psyco.

@PnP Bios:
Knowing C and C++ won't do you much good. There are paradigms and techniques that those languages are ill-suited for (cue somebody whining about how C++ is multiparadigm, blah blah). Take the class. You'll learn more than you expected.
Quote:Original post by Pxtl
Plus, Python will teach you about many aspects of OOP that you don't get in C++ that other real, optimized languages like Lisp and Dylan have, for example closures, generators, metaclasses, and various other things.

Closures have nothing to do with OOP. Furthermore, you can use closures (albeit somewhat limited) in C++.
Quote:Original post by CoffeeMug
Quote:Original post by Pxtl
Plus, Python will teach you about many aspects of OOP that you don't get in C++ that other real, optimized languages like Lisp and Dylan have, for example closures, generators, metaclasses, and various other things.

Closures have nothing to do with OOP. Furthermore, you can use closures (albeit somewhat limited) in C++.
Strictly speaking, neither do generators or metaclasses. There are introspection frameworks for C++, too.
Python is great. With the PyGame library you can hack together games in minutes, it's a fast RAD environment (particularly for networking and GUI apps) and it's a lot cleaner than other "learner languages" (*cough*PASCAL*cough*).

As a bonus, the syntax is not far off from C++.
from the small amount of experiance i had with Python, i really enjoyed it. i found it a little too much work to embed in C++ though and used Lua instead. also, from what everyone told me, Python is more suited to be the core language of a game with C embedded into it, and not vise versa. the only thing that bothered me about Python was the indentation-instead-of-brackets thing. i'd rather see brackets, but then again i'm probably just spoiled by C++.
FTA, my 2D futuristic action MMORPG

This topic is closed to new replies.

Advertisement