4 ms·
For me it's somewhat strange that it is universally presented as a beginner's language. Python would be hugely confusing to me if I didn't keep the underlying C
by random_upvoter 8y ago
For me it's somewhat strange that it is universally presented as a beginner's language. Python would be hugely confusing to me if I didn't keep the underlying C model -- dynamically allocated objects with reference counts -- in mind at all time. Together with a lot of protocol that is largely arbitrary.
- tdb7893 8y agoI've met a lot of people who have programmed simple things in python without understanding the memory model at all so for most people it doesn't seem to be a large impediment.
- xxpor 8y agoTo me that would only be relevant if I'm doing super performance sensitive stuff, and if that's the case I wouldn't be using Python. I've been programming in both C and Python for years and never once have I had to consider reference counting in Python.
- criddell 8y agoWould you also find Excel macros hugely confusing if you didn't know the underlying C model? Because I think that's the level of programming that the masses are doing.
- ummonk 8y agoIn all this time I didn’t even know python uses reference counting instead of tracing gc...
- ASinclair 8y agoCan you provide an example of why you need to understand the underlying C model? I don't think I've ever considered it when writing a Python program.
- danso 8y agoWhen teaching Python to beginners, I struggle with the concept of mutability -- e.g. `sorted(mylist) vs mylist.sort()` without being able to refer to the concepts of memory and references. But it's not a terrible obstacle if you drill in extra adherence to logic and testing and jumping into REPL. After enough trial-and-error with `x is y` `x == y` and `id(x)`, the abstract concept comes through without having to acknowledge the existence of reference count.
- alimw 8y agoHardly a beginner at programming, but I also struggled with this when I picked up Python recently. The documentation doesn't make it obvious when functions have this sort of side effect, so like your students I play with the REPL to establish exactly what a function will do. Even then an unexpected side effect was the source of the single most perplexing bug in my program. I imagine that in complex programs this philosophy of sometimes-mutability-sometimes-not must lie at the root of a huge amount of programming error.