Ask HN: Is it worth it to learn C to better understand Python?
1–10 of 93 posts
Re: Ask HN: Is it worth it to learn C to better understand Python?
#2Interfacing with python with your own C code is easy and the combination of the two is a much more powerful tool than either alone.
Re: Ask HN: Is it worth it to learn C to better understand Python?
#3I would choose Python for fast prototyping and proofing-of-concepts, C for performance-intensive apps.
Re: Ask HN: Is it worth it to learn C to better understand Python?
#4Re: Ask HN: Is it worth it to learn C to better understand Python?
#5What about Python are you trying to understand? You can learn more about Python internals without needing too much C. And you can get better at Python without knowing much about the internals or C. So it looks like a waste of time.
Re: Ask HN: Is it worth it to learn C to better understand Python?
#6you might be able to grep cpython source more intelligently, but it won't help you at all with the semantics of the python language itself (versus its dominant implementation), and might hurt.
Re: Ask HN: Is it worth it to learn C to better understand Python?
#7Re: Ask HN: Is it worth it to learn C to better understand Python?
#8If what you really want is to write or read C, then of course you should learn C.
Re: Ask HN: Is it worth it to learn C to better understand Python?
#9For instance, when you only need to write two curly braces to create a “dictionary” (of course behind the scenes this is a hash table) many of the nuances of that data structure are hidden from you. You have no idea that accesses are O(1) amortized but worst case are O(n). Even if you do, maybe you don’t understand why. You have no idea that there is reallocation and collision handling code working behind the scenes constantly.
Python also lacks a number of nuances I consider it important to be aware of. You live your entire Python life blissfully unaware that everything is a pointer, and the impact that has on performance. You never come across static typing, or that it is possible to check your code for some level of syntactic correctness before it runs (i.e. Python is interpreted rather than compiled).
I think from this standpoint, it is worth learning a language like C to gain an appreciation for how truly complex a lot of the things Python allows you to do, are. I think that anything which helps you better understand what it is you are doing, how you are doing it, and why you are doing it that way, will make you better at doing that thing.
Re: Ask HN: Is it worth it to learn C to better understand Python?
#10I would say it depends on what you want to do. I would choose Python for fast prototyping and proofing-of-concepts, C for performance-intensive apps.
Don't let the fact that it has a garbage collector scare you -- you can turn it off if you don't like it.