Learning C++ for Python Development

J

joshua.pearce

I am a recovering C# web developer who has recently picked up Django
and I'm loving it.

I would eventually like to get a job as a Django/Python developer. It
seems that many Python jobs require that you also be a C++ developer.
While I want to remain primarily a web developer, I don't want be
stuck doing CRUD applications, so I would like to learn C++ for Python
development. I have taken two basic programming courses in straight up
C++, no STL, Boost or anything like that, but I do have a very basic
knowledge of the language.

Can you folks suggest some Python packages which use C++ and are
relevant for web development, so I can dig through the source and
contribute in some way?

Or, just give me some general advice on learning C++ for Python?

P.S. I want to develop on Linux not Windows.

Thanks!
 
R

Roger Binns

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Or, just give me some general advice on learning C++ for Python?

You may want to start with Cython first. It lets you intersperse C and
C level information with Python code to produce extensions. That will
give you a gentler introduction to using a C like language with Python
and for many real world uses is actually sufficient to get C levels of
performance and interfacing with Python.

After you get that working then you can try coding your own extensions
(the Python docs include all the necessary information) and also trying
other tools such as SWIG which automate some of the code for wrapping
C++, or the wrapping functionality present in Boost.

I find it most helpful to explore doing the same thing in multiple
different ways as it teaches you what is important and what isn't.
Later on it will help you a lot better in choosing the right tool for
the job (no one tool or approach is perfect) and help evaluate anything
that comes up later.

My suggestion would be to pick a particular task and code it in pure
Python. Benchmark it (cpu and memory) and then try the other approaches
(Cython, Boost, hand coded, SWIG) and see how they compare. Something
like a brute force Suduko solver would let you have a few
classes/objects but not be too much code.

Roger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkoHy/QACgkQmOOfHg372QTxywCgrJPcHLQ5BzD8O29nSAW+I5xo
juYAnjMP0xqn/TzC5mrTCqBT3ZnIQo24
=KeIk
-----END PGP SIGNATURE-----
 
G

Gerhard Häring

I am a recovering C# web developer who has recently picked up Django
and I'm loving it.

I would eventually like to get a job as a Django/Python developer. It
seems that many Python jobs require that you also be a C++ developer.

I've seen the C++/Python combination in job descriptions, too. ISTM that
these are about systems that are written in C++ and then scripted in
Python. For speeding up Python applications.
While I want to remain primarily a web developer, I don't want be
stuck doing CRUD applications, so I would like to learn C++ for Python
development.

In the web development field, the probability for doing custom C/C++
development is very low in my experience.
I have taken two basic programming courses in straight up
C++, no STL, Boost or anything like that, but I do have a very basic
knowledge of the language.

Learning progamming languages never hurts, but I'd recommend you learn C
instead, perhaps by using the Python C API (writing small extension
modules).

There are not so many Python extensions written in C++, most are written
in C. C++ usually doesn't buy you enough to warrant using it instead of
C here.

So my advice: go with C. Or learn something more relevant to web
programming. Like improve your JavaScript skills ;-)

-- Gerhard
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top