🔒 Locked
Why do I need to learn Python?
Advertisement
Original Post
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?
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.
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.
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.
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.
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.
Quote:You forgot about Psyco.
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.
@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:Strictly speaking, neither do generators or metaclasses. There are introspection frameworks for C++, too.
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++.
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++.
Quote:
Original post by Woodsman
Could anyone list some good Python sites and/or books? Specifically with relation to OpenGL development with it? (Not to derail the thread...)
Python.org - the tutorial covers the basics of the language, which you can learn in a day or two.
Then you might want to Google PyOpenGL, which I believe is available for the 2.3.x series now. Also, give PyGame a search, it's an SDL port which is very, well, easy to learn and fun to play with.
Have fun.
I'm probably going to be the first one to say this, but
Don't take the Python!
Don't you see what it does to everyone!!! It makes them make other people take it and it never stops consuming. Resist!! Assembly pwns all btw.
Don't take the Python!
Don't you see what it does to everyone!!! It makes them make other people take it and it never stops consuming. Resist!! Assembly pwns all btw.
Quote:I have done a little work in Python. I have to learn it (it with OGL, rather) soon for work. Thanks a lot for the names, I had found a few things but wasn't sure on the best approach. I'm not sure what they're using, exactly, so I figure anything is a step in the right direction. Cheers.
Original post by Drevay Quote:
Original post by Woodsman
Could anyone list some good Python sites and/or books? Specifically with relation to OpenGL development with it? (Not to derail the thread...)
Python.org - the tutorial covers the basics of the language, which you can learn in a day or two.
Then you might want to Google PyOpenGL, which I believe is available for the 2.3.x series now. Also, give PyGame a search, it's an SDL port which is very, well, easy to learn and fun to play with.
Have fun.
Python is a nice language, not my preferred language, but it is nice.
Learning Python is a very nice book to have for beginning the Python language. There is also Programming Python. The Python.org tutorial is also fairly nice.
for OpenGL there is PyOpenGL
Learning Python is a very nice book to have for beginning the Python language. There is also Programming Python. The Python.org tutorial is also fairly nice.
for OpenGL there is PyOpenGL
Quote:
Original post by CoffeeMug
Furthermore, you can use closures (albeit somewhat limited) in C++.
How?
@Arild: He may be thinking along these lines?
Anyway. Python offers HUGE amounts of "hack value" to the experienced programmer; I'm still discovering fun little bits of it. The introspection blows Java's out of the water. (Hell, you can even change an object's __class__ - the underscores are not for emphasis but to illustrate the language syntax :) ) You get to play with a bunch of FP toys while keeping a relatively familiar syntax. At the cost of having to keep a little more organized and disciplined, you practically get all of the good things about Perl (except CPAN) with none of the bad.
Anyway. Python offers HUGE amounts of "hack value" to the experienced programmer; I'm still discovering fun little bits of it. The introspection blows Java's out of the water. (Hell, you can even change an object's __class__ - the underscores are not for emphasis but to illustrate the language syntax :) ) You get to play with a bunch of FP toys while keeping a relatively familiar syntax. At the cost of having to keep a little more organized and disciplined, you practically get all of the good things about Perl (except CPAN) with none of the bad.
a lot of organizations use python for their live code, such as NASA. They say that it is easy to develop good code, quickly. Python has some nice features. In my first 15 minutes of learning the language (okay, it was 15 minutes and 10 seconds, I was actually timed) I wrote a script to print out a circle of periods on the screen.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement