Hacker News new | ask | show | jobs
by sarchertech 1385 days ago
If you need to understand what Python is doing under the hood, you’ll have to have some understanding of pointers.

Not having a decent mental model of what’s happening a few levels below severely limits the kinda of problems you can solve.

2 comments

That's a bit harsh.

I'm familiar with C/C++ and how pointers work, but that part of my mental knowledge never comes into play when I write python code, whether Django or not. And I've written substantial code in these two environments, they don't really intersect.

I mean, maybe once in a couple years you'd run into some weird problem that requires deep knowledge to solve, but "severely limits" might be a bit of an overstatement. (And might be some form of unwarranted gatekeeping IMHO.)

Everyone has limits/gaps in their knowledge, while C and pointers are part of the standard curriculum for CS degrees, not everyone has to be such cookie cutter devs (as long as they do their job and their employers are happy)

When the OP said they "have no idea how pointers work", I took that to mean they don't know know anything about how memory works. Why does does copying this array, not copy the contents of the array. Why does accessing a random value in a linked list take so much longer than accessing a random value in array. What happens when I reassign a local variable.

Developing an underlying mental model of what's actually happening is so much more effective than treating a programming language like a black box.

As far as "severely limits", there are many jobs where you could spend your entire wiring together libraries and asking more senior developers for help when you run into edge cases. But if you want to be one of those people who gets called in to help, you need a basic understanding of memory indirection. You don't need to understand pointer syntax in any specific language, but you need to have some understanding of what happens when you type x = [1,2,3].

At many tech companies, I doubt you could even make it passed the interview without a basic understanding of what a pointer is.

What sort of problems would you need to be doing in Python that aren't already done by libraries like NumPy which would require that sort of mental model?
The only thing that comes to mind would be memory leaks in long running applications caused by your data structures having some link to a link to a link that prevents temporary data from being garbagecollected.