tags:

views:

768

answers:

11

I'm a newbie to programming. I had 1 semester of computer science (we used java). I got an A in the course and was able to do everything assigned, however I'm not sure I really understood it. I ignored the text and learned by looking at sample programs and then trial and error. I was ahead of the class except for two guys who came in knowing java or another OOP language.

I'd like to learn Python. I'm also going to build a second PC from extra parts I have and use linux. Basically, I want to enhance my knowledge of computers. Thats my motivation.

Now on learning python are there any good programming theory books that would be useful? Or should I read up on more on how computers operate on the lowest levels? I don't think I know enough to ask the question I want.

I guess to make it simple, I am asking what should I know to make the most of learning python. This is not for a career. This is from a desire to know. I am no longer a computer science major (it also would not have any direct applications to my anticipated career.)

I'm not looking to learn in "30 days" or "1 week" or whatever. So, starting from a very basic level is fine with me.

Thanks in advance. I did a search and didn't quite find what I was looking for.

UPDATE: Thanks for all the great advice. I found this site at work and couldn't find it on my home computer, so I am just getting to read now.

+1  A: 

Python is a high-level language, so it wouldn't give you much direct benefit to learn how computers operate at the lowest levels.

Don't get me wrong - I do strongly believe that the low-level operation of a computer, e.g. assembly language and hardware, is something that every good programmer should be familiar with, because it does help you program more effectively in whatever language you are using, high-level or low-level. But it won't make much of a difference in your Python coding until you've gotten quite a bit of experience. If you're just starting out with Python, I would suggest staying away from the low-level operation of computers and concentrating on the basics of Python for now. Once you're comfortable with that, you can move on to something like C and then it might be appropriate to start looking at some lower-level stuff.

As for what you should know... not much, I guess. Python is a great language to start out programming in. It keeps simple things simple but it's rich enough to let you work your way up to a high level of complexity. I'd suggest probably looking at a tutorial; the one I happen to know is on the Python website, but I'm not claiming it's necessarily the best one for you. A Google search should give you plenty to get started with.

David Zaslavsky
+4  A: 

http://www.pythonchallenge.com/

I think this Challenge is perfect to get in touch with major python strengths and there is a nice forum with a lot of interessting Python Threads for each Level.

bastianneu
+14  A: 

My recommendation is always to start at the high level of abstraction. You don't need to know how logic gates work and how you can use them to build a CPU -- it's cool stuff, but it's cool stuff that makes a lot more sense once you've messed around at the higher levels. Python is therefore an excellent choice as a learning aid.

How to Think Like A Computer Scientist: Learning With Python is available on the Internet and is an excellent introduction to the high-level concepts that make computers go. And it's even Python-specific.

If you're looking to have your brain turned inside-out, SICP will do a good job of it. I don't recommend it as a first text, though; it's heavy going.

Both of these books are high-level. They won't teach you anything about the low-level details like memory structures or what a CPU actually does, but that's something I would reserve for later anyway.

D'A

darch
I would strongly second the recommendation of SICP. You will _never_ be the same after you go through it. To be paired with that is the SICP Lectures http://groups.csail.mit.edu/mac/classes/6.001/abelson-sussman-lectures/
docgnome
If you want to watch some course materials that cover SICP in a lecture format, try watching the free UC Berkeley CS 61A lectures here: http://webcast.berkeley.edu/course_details.php?seriesid=1906978342Taught by the one and only Brian Harvey (whom you will know if you have read *Hackers* by Steven Levy.)
Josh K
A: 

enhance my knowledge of computers

Well, what do you exactly mean by that? Python, or any other high level language, are designed to actually hide all the nasty details. That's one of the reasons, why it's apt for non-pros like (e.g. scientist).

If you want to know how stuff actually work, you should learn pure C. But then again, if you're not planning to have any career related to SC, there's not much point to it. Learn some more advanced algorithms and data structures instead. That'll result you more interesting, useful and is platform- and language-agnostic.

vartec
+9  A: 

Specifically for the Python part of your question I can highly recommend http://www.diveintopython.org/ by Mark Pilgrim. That's free and pretty well structured.

Python is a nice choice, you will have fun!

Valentin Jacquemin
A: 

Short answer: all of them

Long answer:

Learning your first language is always a challenge, and after your Java experience, a lot of other languages will seem a lot simpler. That said, the real challenge in learning programming languages is learning when to use a particular language -- you can find decent docs for whatever you choose when the time comes.

As a concrete start, hop over to wikipedia and browse their categorical list of programming languages, click on all of the names you've ever heard (and anything else that catches your eye) and if the article has a code example, give it a minute or two to sink in (the rest of the article will help, of course). The point here is not to master every single language (which is (1) pointless and (2) impossible), but to get a handle on what is out there. For any language, there is a handful of other languages like it, and if you can at least read one language in most of those categories, you will have mastered a fairly large chunk of the programming universe. When a new project comes up, and something about it reminds you of some language you found, you can just learn that language as part of doing the project. It may sound like a lot of work, but after, say, your fifth big language, you completely lose count and just accidentally learn new ones all the time without noticing.

When you stop relating to one language as your home-language, you'll be able to learn from examples in other languages even if you've never programmed in them. Personally, I've only written a few Haskell programs, but being able to read Haskell has exposed me to a lot of ideas that I could recycle in more practical Scala and Python programs (oh yeah, after you learn Python, give Scala a browse and you'll probably never use Java again)

Even finding the best language for the job isn't the whole story. Having a lot of tools in your toolbox lets you throw together amazing stuff in short amounts of time by writing each piece of your project in the easiest language your could. This may not be appropriate for all projects, but, boy, can you make some impressive demos.

It takes many years to get to the point where no programming language is totally foreign (or at least foreign for more than a day of hacking), but I think it is a very healthy and realistic long-term plan to attempt to conquer a representative sample of each rough category. Good luck!

rndmcnlly
+3  A: 

A lot of this depends on what your overall goal is for learning Python. Are you viewing it as learning a second language or getting a better understanding of computers and how to effectively use a programming language?

From what it sounds like you want to gain a better understanding about computers and be a better programmer. Learning a new languages such as Python will probably not help you in this respect. I still recommend learning Python if you're interested, but once you have learned one programming language, much of learning a new language is getting familiar with the syntax and data types (usually).

You had mentioned you were unsure about understanding the material in the class you took. If you feel you don't understand fundamental concepts (such as loops, classes, etc), then learning Python will help your understanding of programming as most books/guides revisit these concepts (Learning Python, 3rd Edition should help with this). If you understand these concepts, but you are unsure of how to apply these concepts, then my recommendation would be to learn about data structures and common algorithms (e.g. sorting, searching, etc).

Speaking from personal experience, I didn't know how to apply what I learned from the introductory programming class to personal programming projects. Learning about data structures from a class helped solidify those concepts I had previously learned by providing algorithms/data structures that build off of this previous knowledge. This class also allowed me to think differently about problems in terms of using these data structures.

To learn about the different types of data structures, see: http://en.wikipedia.org/wiki/List_of_data_structures. Usually, each data structure is useful for a specific purpose (e.g. binary search trees are good for searching sorted information). Unfortunately, I don't have any book recommendations (our class didn't use a book). Googling "Data Structures" should be a good starting point.

Data structures also got me to think about how efficient an implementation is. The "complexity" of an algorithm determines how long a given piece of code takes to run. This makes it easy to compare other implementations and determine which is better.

I would also like to comment that when it comes to learning computer concepts, the best way to learn is by doing. A book/class can only explain so much, and the rest you have to learn on your own. Each person learns differently, and programming is a way of taking the material you read about and think about it in a way that is best understood by you.

I hope I answered your question. At this point, you don't really need to worry about the underlying hardware. This is useful to know if you plan on doing this as a career (which you aren't), or want to make optimizations specific to the hardware you're running on (in which case, you wouldn't want to use Python). Python is a good choice to learn about data structures as it implements a lot of them for you, but it's important to know what they are used for.

If you are still in school, take a data structures class and see what you think of it. If you like it, I'd advise reconsidering the role of programming/CS in your career. You don't have to major in it, but consider a minor or at least a position that makes use of these skills you are learning. I say this because despite this not being your major, you are interested in understanding how a computer works and taking initiatives such as learning Python, building your own computer, and installing Linux.

If you have any further questions, feel free to ask. Good luck!

mgriepentrog
A: 

Since Python wasn't my first language, I found the Python Cookbook helpful for learning

  1. What Python was capable of
  2. The idiomatic, of "pythonic," way to do something.
joshdick
Glad you liked it;-).
Alex Martelli
+1  A: 

I started Python (as my first programming language) few months ago. I would recommend Learning Python, by Mark Lutz to begin with. But keep in mind that the key to learn well is to be open-minded, patient and willing to work and look up for things you don't understand.

Have fun!

Orphee
+1  A: 

I would suggest looking at the online book at http://www.diveintopython.org/ to learn python.

As for python projects, I would try learning the Django Framework. It is a framework for building web applications. They have a great tutorial for getting started with it. This would also give you experience building a webserver on a Linux box.

Eldila
Thanks, very excited about Django.
Jeff
A: 

Programming language teaching has always been associated with a cliche statement while learning. "Write programs to learn programming". I too would suggest the same.

If you are going to start from basics. This is of course, the most suggested starting point. It is lengthy, but it is worth all the time. http://www.diveintopython.org/

Because you are into some Java, this might be even better for you. http://www.swaroopch.com/notes/Python. Start either python 2.x or 3.0. Me personally am a fan of python 3. But for a starter it could be hard to get samples, and references to programs online. So for you 2.x might be better. But I leave it upto you.

Like I started "Write programs..". You can start here.

  1. http://www.spoj.pl/ - a programming challenges site, where you can choose from a wide variety of topics, mostly algorithms and has huge question database. Of course the choice of programming languages is upto you.
  2. http://projecteuler.net/ - a mathematical questions site, here you just have to submit an answer, cheating is allowed here, so be free to borrow logic from others, but try writing the program yourself.

After you think you have gained sufficient proficiency in python, you can try recipes in this book python cookbook http://www.amazon.com/Python-Cookbook-Alex-Martelli/dp/0596007973.

For application development, after you think you can handle it, start on wxPython or PyQt. I personally would suggest PyQt. It is responsive, fast, and has decent development cycle, I have not used WxPython for long, but few programs I wrote, long back, didn't feel so great. Yet again, its upto you.

roopesh