

Ask YC: Python or C ? - g__g

Hi all,<p>I have just got out of high school and now into my first year of bachelors in computer science. I have been interested in programming since long. I started with a python about 2 months back, as I had read at a lot of places that it's best recommended for beginners. I've read a book on it and now have learnt all the basics of it. I have written a few handy scripts here and there. I have a basic idea of OOP as well. And now I was about to explore various modules in python.<p>But my first semester exams in college are approaching and I have an exam on C. Its just basic stuff like declarations, bits about data structures, looping, functions etc. The curriculum is really introductory. I am quite sure that I will manage by giving it a week or so.<p>The problem is that I don't think it is a wise idea to just study introductory C (btw it was the language I wanted to learn after python). Mainly its a personal thing, if i begin C, I would rather get deep in it than study just basics. I don't see a point in just teasing my curiosity and then moving away from it. My major area of interest is in network protocols such as TCP UDP STP and SIP.<p>Please give your opinions on whether I should pick up K&#38;R and then go forward from there into C or  do the bits to clear my exam and get back on python. I am aware of the fact that I can always embed C into python code.<p>Thanks in advance
======
SwellJoe
It's not either/or. The best developers happily flit from language to
language, as the job requires. Don't be a purist or a language snob. Purists
are assholes, and don't get shit done.

C is a fine systems language, and K&R is one of the best programming texts
I've ever read. I haven't used C seriously in several years, but I don't
regret the time spent learning it (Pascal, maybe, I feel like was a waste of
time...but definitely not C).

Learn both. Even better, learn how to use one with the other, via ctypes,
SWIG, etc. That'll put you head and shoulders above a large percentage "Python
developers" on the type of projects you can tackle, and make you more
productive than a large percentage of "C developers".

------
rw
C is pretty print for assembly - you will learn much about how the von Neumann
architecture operates. Python, on the other hand, is an excellent "glue"
language, but it fails to allow us to program in a "highly-abstractable" way
(like Lisp) or to easily produce fast code (like C).

In the tower of abstraction, I've found it more useful to learn the bottom and
the top, and leave the middle to be figured out on a per-project basis; e.g.
learn assembly/C, Scheme/Common Lisp, then Python to make implementation
details easier.

Also, you could learn 2-4 languages concurrently. This makes for a challenging
ride but it is also empowering, because you can compare them so easily.

~~~
noodle
good points. i'd like to think he'd take a class in his CS curriculum where he
has to learn a few languages either concurrently or consecutively but very
quickly.

------
qhoxie
If networking and protocols are your primary area of interest, then C is what
you need for that. I think that C and python together make a powerful arsenal,
and recommend you work with both at the same time, but I understand you want
to dive full into C if you dive at all.

K&R will be what you need to get started, and past that, you could pick up
some protocol specific information. Implementing protocols in C is common
practice, and there are plenty of good ways to exercise those skills such as
implementing sliding window atop UDP or the like.

~~~
g__g
I think i'll go with both hand in hand, thanks for the advice.

------
noodle
if you're at a decent computer science school, you're going to eventually
learn that languages are tools. there's definitely something to be said about
becoming a python expert, but there's also something to be said about having
the flexibility to know that python is not the best solution for every
problem.

learn the basics of C. even better, learn how languages work and learn how to
learn them, because there will always be new, better languages and
methodologies. the C experts of yesteryear that put all their stock into one
language are now the stodgy dinosaurs stuck in their jobs today.

learn the basics of C. ESPECIALLY if its for a grade. i learned so much
garbage at college that i've totally forgotten, as well as so much stuff that
i didn't really _need_ to know but that i am better for having learned it,
anyways.

thats my $0.02.

