Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Get better at C or at Python

  1. Jul 7, 2012 #1
    Im a Comp Eng student, and i have about 2 month of vacation, but i really got nothing to do.. I know C better than python, just wonder if in this 2 months, what you guys recommend i should get better at C or at python?

    Note: those are the only two languages i know so im open to other recommendations.
     
  2. jcsd
  3. Jul 7, 2012 #2

    jambaugh

    User Avatar
    Science Advisor
    Gold Member

  4. Jul 7, 2012 #3

    chiro

    User Avatar
    Science Advisor

    Hey SuperMiguel.

    For your question, and given you are a Computer Engineering student, I recommend you progressing with C.

    The reason behind my suggestion is that C is a kind of low high-level language that is used extensively for multi-platform design, and in particular for environments where you use specialized forms of the language to directly program custom hardware platforms.

    Being a computer engineer means having a tendency to work in these kinds of environments as opposed to the much higher level ones commonly used in the standard x64 or similar environment on say a Windows OS.

    The other reason for getting C down is that once you really know what is going on with C, you will be able to take that knowledge and apply it to anything else. A few examples are in order:

    Firstly, if you are able to debug anything effectively in C whether it's some kind of memory access error (which represents a majority of the problems), some kind of stack error, allocation error, device error, library error, and so on, then when you move to another environment like say an interpreted language like Python or even something like .NET, you will be able to at least get a pretextual picture of what is probably going wrong, because you will understand things at the memory, device, and other levels.

    Secondly, because most procedural languages are pretty much the same, knowing one in a great depth is easily translatable to another and the depth of knowing one is a lot better than just knowing a lot without any deep context or clarity.

    The thing is that when you develop, you will have to adapt to whatever is used and whatever is required to get what you need done which means that at some point, you will probably have to pick up something quick that has a reference point to what you have done in the past like say C.

    I don't know if you have specific goals though that deviate from this, and it's important to also state that learning Python for the sake of learning because it is interesting, or has a specific library, or anything else is more than enough of a reason to choose Python.

    If you have a specific goal in mind or at least a directed form of investigation, it would benefit the readers if this was made clear.

    One thing that I have learned in my experience is that it's a lot easier to do something when you have a clear direction. When the direction is not clear, then it becomes hard to really stick to something and things tend not to get done when you just do things that are all over the place.

    Investigation though does not mean that everything goes according to a plan that is down the second: it will involve unexpected discoveries, lessons, and its share of failures.

    The basic idea though is to set a few very simple, but flexible goals that have enough room for investigation, discovery, and relaxation of rigidity, but definite enough so that at the end you actually make what you would consider substantial progress to getting that particular thing done.
     
  5. Jul 13, 2012 #4
    I know C and Python and am familiar with embedded hardware e.g. Arduino but I am approaching this as a CompSci BSc and hobbyist programmer - not CompEng or CSEE.

    From where I sit, it doesn't matter which you learn. All imperative languages work in the same way. If you can write fibonnaci or prime number search in C or in Python, you know how do it in the other, and also any other imperative lang like Java, Ruby, Ada, Pascal, Fortran etc. You might not know the specific syntax of e.g. a for loop in Pascal but you understand what it is and when to use it, and you can look up the syntax in 5 seconds on Google.

    I could write

    for a := 1 to 5 begin
    print a*a
    next a

    And you understand that - despite it being neither Python nor C. (If you don't understand that, there is a problem).

    So, not counting the ENG part of your course, learn the one that you like better, that lets you code quicker, had better tutorials, whatever. It won't really matter from a CompSci point of view.

    I don't understand the specific requirements of the ENG part but I know that both Python and C (as opposed to C++) are well used in engineering circles. C obviously produces faster and smaller code than Python, but then again it takes much longer to write (and it depresses me with how much longer it takes to write and debug).

    For general purpose programming work I find Python's performance is adequate. Even driving Arduino, even only limited horsepower systems like a Raspberry Pi, I've never had a speed problem with Python. If I did, that's fine, I'd use C++ where I needed to.

    If you're looking at other langs then from a CS/hobbist point of view, Java is a must for android and websites, Haskell because always good to have at least 1 functional language to stretch your brain! And of course C++ or C# for PC development. Objective C (for iPhone) as well. Perhaps Javascript, very useful for websites. I would avoid PHP, it's a mess and Python/Java do websites.

    I don't know if you do a lot of stuff like washing machine controllers in in ENG part of your course; I imagine you probaby use a custom realtime language for those. I think writing games is good practice there, and lots of fun. A game is a real time control system with zero lag tolerance.
     
    Last edited: Jul 13, 2012
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Get better at C or at Python
  1. Python to C++ (Replies: 9)

  2. Python or C++ first? (Replies: 20)

  3. Learning python and C# (Replies: 14)

Loading...