[OT] Good C++ book for a Python programmer

R

rick_muller

I'm picking up C++ again after years of using almost nothing but
Python. I'm frankly enjoying the experience, and it's certainly
deepening my appreciation of Python (which you can read however you
like).

I was wondering whether anyone could recommend a good C++ book, with
"good" being defined from the perspective of a Python programmer. I
realize that there isn't a book titled "C++ for Python Programmers",
but has anyone found one that they think goes particularly well with
the Python way?

I'm asking this because evidently the C++ standard has changed a bit
since 1994, when I bought my books. Who knew that fstream was
deprecated?

Thanks in advance...
 
B

beliavsky

Rick said:
I was wondering whether anyone could recommend a good C++ book, with
"good" being defined from the perspective of a Python programmer.

The STL and the template feature of C++ gives the programmer some of
the functionality of Python (using templates instead of duck typing,
vectors instead of lists etc.), so a book that introduces these
features early, such as "Accelerated C++" by Koenig and Moo, could be a
good start for a Pythonner. The 4th edition of the well-known "C++
Primer", with Moo as a new co-author, will soon be published. It is a
more comprehensive and much longer book.
 
T

Thomas Bartkus

I'm picking up C++ again after years of using almost nothing but
Python. I'm frankly enjoying the experience, and it's certainly
deepening my appreciation of Python (which you can read however you
like).
Gad! After Python, how can you stand it (C++) ?
Adding object oriented utility to the C language was an atrocity, albeit
perhaps a necessary one given the state of the art when that particular
atrocity was committed. Aren't we past this?

If it is fast, fully compiled code you seek - couldn't you just C a few slow
functions and use them in your Python?

Thomas Bartkus
 
P

Paul Rubin

I was wondering whether anyone could recommend a good C++ book, with
"good" being defined from the perspective of a Python programmer. I
realize that there isn't a book titled "C++ for Python Programmers",
but has anyone found one that they think goes particularly well with
the Python way?

I think it's not possible to really grok C++ without having worked on
large multi-person C projects and understood what problems C++ tried
to solve. The only good book I know about C++ is by Stroustrup, "The
C++ Programming Language" or something like that; it's not an easy
book though.
 
A

Andrew Koenig

The 4th edition of the well-known "C++ Primer", with Moo as a new
co-author, will soon be published. It is a
more comprehensive and much longer book.

It is also organized more traditionally than "Accelerated C++."

"Accelerated C++" is mostly example-driven: It presents problems, shows how
to solve them, and introduces language and library features as needed for
particular parts of the solutions. Of course the problems are carefully
chosen so that the solutions cover the most important parts of the language
and library, but that fact is not immediately obvious from the nature of the
problems themselves.

"C++ Primer" follows the classical approach of treating each part of the
language and library separately in a single place. For example, there are
chapters on expressions, statements, functions, templates, object-oriented
programming, and so on. It is also much more systematic than "Accelerated
C++." It is also nearly three times the size.

Which of these books you prefer will depend on your learning style more than
anything else. If you are willing to read the entire book sequentially, you
will probably learn C++ faster from "Accelerated C++" than from "C++
Primer." On the other hand, if you want to see in one place what all the
different kinds of statements are, so that you can learn about them all at
once, then you will be more comfortable with "C++ Primer."

I'm biased, of course, but I believe that either of these books is a better
starting point for someone unfamiliar with C than any other book I can think
of.
 
J

John Hunter

Philippe> I suggest you google 'C++ tutorial' Regards,

Stroustup's "The C++ Programming Language" is the best C++ book I've
read. It is at a fairly high level, and I already had read several
C++ books before reading it, so it may be tough sledding. But I would
try this first since you are an experienced programmer and know OO
concepts, and if it fails to satisfy try something lighter.
Unfortunately, I didn't like any of the other kinder, gentler overview
books I read on C++, so can't really recommend anything along those
lines, though I'm sure they are out there.

JDH
 
S

Scott David Daniels

John said:
Philippe> I suggest you google 'C++ tutorial' Regards,

Stroustup's "The C++ Programming Language" is the best C++ book I've
read. It is at a fairly high level, and I already had read several
C++ books before reading it, so it may be tough sledding. But I would
try this first since you are an experienced programmer and know OO
concepts, and if it fails to satisfy try something lighter.
Unfortunately, I didn't like any of the other kinder, gentler overview
books I read on C++, so can't really recommend anything along those
lines, though I'm sure they are out there.

JDH

For a rationale as to why the language developed the way it did, you
can read Stroustrup's "The Design and Evolution of C++". This is no
good for learning the language, but it might be a good library borrow
to find out why the language is the way it is.


-Scott David Daniels
(e-mail address removed)
 
C

Craig Ringer

The STL and the template feature of C++ gives the programmer some of
the functionality of Python (using templates instead of duck typing,
vectors instead of lists etc.),

I'm particularly fond of internally refcounted objects (as used
extensively in Qt) and of guarded pointers, myself. The use of these two
things means one can avoid the "sometimes works, sometimes doesn't" fun
of referencing deleted memory by accident.
 
V

Ville Vainio

Rick> I was wondering whether anyone could recommend a good C++
Rick> book, with "good" being defined from the perspective of a
Rick> Python programmer. I

A good C++ book from the perspective of a Python programmer would be
one proclaiming that C++ is deprecated as a language, and it has
become illegal to develop software with it.

Rick> realize that there isn't a book titled "C++ for Python
Rick> Programmers", but has anyone found one that they think goes
Rick> particularly well with the Python way?

I don't think that's possible, considering the nature of the
language. Templates are closest to the Python way as far as C++
technologies go, but they are very unpythonic in their complexity.


Rick> I'm asking this because evidently the C++ standard has
Rick> changed a bit since 1994, when I bought my books. Who knew
Rick> that fstream was deprecated?

Stroustrup book, already mentioned by others, is the one if you just
need a "refresh" your knowledge. "Effective C++" and "More effective
C++" are also great to learn about all the nasty gotchas that your
Python experience might make you neglect. They are also certain to
deepen your appreciation of Python ;-).
 

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,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top