After C++, what with Python?

A

Aman

Hey all, I am a college student, and at college, we did most of the work in C/C++. I kind of stopped using C when I learned C++ (simply because C++ seemed a natural/elegant choice to me, and had backward compatibility with C).. I've had a lot of experience with C++.
Recently, I was on the path to learn a new programming language, and after suggestion of some of my friends and consulting the web, I chose to proceed with Python. I've finished with core Python and now I'm going through the various inbuilt packages that Python provides. I have an inquisitive mind, and while programming, I always want/tend to make something that is out of the box. It would be great if you people could guide me as to what to proceed with and how.
 
J

John Nagle

Hey all, I am a college student, and at college, we did most of the
work in C/C++. I kind of stopped using C when I learned C++ (simply
because C++ seemed a natural/elegant choice to me, and had backward
compatibility with C). I've had a lot of experience with C++.
Recently, I was on the path to learn a new programming language, and
after suggestion of some of my friends and consulting the web, I
chose to proceed with Python. I've finished with core Python and now
I'm going through the various inbuilt packages that Python provides.
I have an inquisitive mind, and while programming, I always want/tend
to make something that is out of the box. It would be great if you
people could guide me as to what to proceed with and how.

If you know C++ well, and have a computer science background.
Python is trivial. Here's what you need to know:

It's a safe dynamically typed imperative object oriented language,
with explicit classes. The language is declaration-free and
block structure is defined by indentation. Threading is supported
but thread concurrency is marginal. The most common implementation is
a naive interpreter with reference counting backed up by a mark
and sweep garbage collector. Performance is about 1/60 of
optimized C code.

That's Python.

John Nagle
 
G

geremy condra

Hey all, I am a college student, and at college, we did most of the work in C/C++. I kind of stopped using C when I learned C++ (simply because C++ seemed a natural/elegant choice to me, and had backward compatibility with C). I've had a lot of experience with C++.
Recently, I was on the path to learn a new programming language, and after suggestion of some of my friends and consulting the web, I chose to proceed with Python. I've finished with core Python and now I'm going through the various inbuilt packages that Python provides. I have an inquisitive mind, and while programming, I always want/tend to make something that is out of the box. It would be great if you people could guide me as to what to proceed with and how.

Here's what I would do:

1. Start off slow; reimplement things you've written in other
languages until you're sure that you understand how Python constructs
differ from superficially similar things in C/C++.

2. Once you've done that, pick a few small tasks (things you would
expect to take about one or two weeks to finish), write all the
high-level architectural code, and then put together a test harness
for them using either unittest[0] or doctest[1]. Pick the one you're
most confident you can write the code for and keep at it until you
pass all your tests. Using the lessons learned from that, refactor the
code of the others and iterate until you feel comfortable thinking
about Python at a high level. As a bonus, you also now have a set of
medium-scale projects with good test harnesses to show off.

3. After you've convinced yourself you know how to write Python, learn
to read other peoples' Python code. Look for small projects (1-5 KLOC)
with 'easy' bugs, get familiar with them, and fix those bugs. It isn't
a race- make sure your work is high-quality, well-tested, and well
documented before you send it to the maintainers. As yet another
bonus, if those patches get accepted you'll be able to tell that to
potential employers.

At this point you'll probably have a much better idea of what you'd
like to do moving forward- you'll probably have found out what kinds
of problems you find interesting, which ones you have an aptitude for,
and what kinds of environments you like. In other words, you'll be
much better off than the vast majority of your peers ;)

Geremy Condra

[0]: http://docs.python.org/library/unittest.html
[1]: http://docs.python.org/library/doctest.html
 
S

Stefan Behnel

John Nagle, 16.01.2011 07:03:
Threading is supported
but thread concurrency is marginal. The most common implementation is
a naive interpreter with reference counting backed up by a mark
and sweep garbage collector. Performance is about 1/60 of
optimized C code.

That's Python.

Since the OP is new to Python (and thus also to this group), it's worth
noting that the above is what John Nagle commonly claims to be important
about Python. It doesn't match everybody's POV.

For most other people, the essence is that Python is actually fun to work
with. And if you come from a C++ background, you will happily appreciate
how simple programming can be. You will also appreciate learning about
Cython, which is the straight forward way for you to write Python code that
interfaces with C++ natively.

Stefan
 
D

David Boddie

Here's what I would do:

[Snip advice]

Maybe it would be good to expand the Getting Started material in the
Python Wiki with your advice, Geremy. It would save you the trouble
of having to type it all over again the next time a similar question
is asked.

David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,699
Latest member
AnneRosen

Latest Threads

Top