4 ms·
Having a good mental model of a language seems like one of the fastest ways to be more productive in that language. Do you have any recommended resources for de
by asleepawake 5y ago
Having a good mental model of a language seems like one of the fastest ways to be more productive in that language. Do you have any recommended resources for developing a strong mental model of python? For reference, Dan Abramov’s course JustJavascript [1] provides an amazing mental model of JavaScript, and Josh Comeau’s css for js developers [2] course provides an amazing model for understanding css. I have 5+ years programming in python but admittedly do not know much about the internals so my mental model is pretty weak!
[1]: https://justjavascript.com/ https://justjavascript.com/
[2]: https://css-for-js.dev/ https://css-for-js.dev/
- hexane360 5y agoOne way I've found is to dig into C/C++ extensions to Python. The Python C API reference is very helpful: https://docs.python.org/3/c-api/index.html https://docs.python.org/3/c-api/index.html It can be quite fun to implement a simple data structure (tree, queue, etc.). in C and bind it to Python. Otherwise, you can get a lot of dirty details by reading the source to complicated/magical libraries (e.g. pickle).
- mynameismon 5y agoI can confirm this works. I was struggling to find why does a = [1, 2, 3] a = b b = b + [1] return a different value as compared to b += [1] Looking into the source code, everything became clear. The + operator returns a pointer to a new list np containing all the elements from a and b, while += merely appends and returns a pointer to the original list
- touchngthevodka 5y agoHave you tried Fluent Python? It really helped to level up my knowledge of the language.
- istjohn 5y agoThere is a truly excellent series of lectures on YouTube from a college course on the Python interpreter internals. But I can't for the life of me find it. One resource I can recommend though is pythontutor.com. It's a tool that will step through your code snippet and show how the code maps onto the internal representation.
- bear8642 5y agoFeel this mental model approach is part of the appeal of Scheme and SICP as you start with simple replace model but near the end (still exploring chapters 4,5) you get shown how to build an interpreter which forces you to know how it all works because otherwise it doesn't. Feel that's sentiment get more now - it's *not* magic but the fact that everything works given it's all illusions is magical
- __mharrison__ 5y ago(Disclosure: This is my content). Why thanks for asking yes I do: I recommend my book, Illustrated Guide to Python 3 [0]. Yes, I teach "professional" Python programmers who lack a lot of the fundamentals. It is so easy to get my with Stack Overflow style of programming these days. (Plus a lot of my students don't want to be "programmers" they use Python as tool to get some job done.) 0 - https://store.metasnake.com/ https://store.metasnake.com/
- TuringTest 5y ago> Having a good mental model of a language seems like one of the fastest ways to be more productive in that language. True, but teaching s programming language is different than teaching programming. Diving into a new language is something you do if you already understand how computers work and how to turn requirements into code. But to first acquire that understanding as a beginner, it's not enough to be introduced to the specifics of any particular language, which is what the article is talking about; you need to clarify what is the role of a programmer in understanding a problem and finding ways to model it as a group of data structures and functions that live in the computer.