r/learnpython • • Feb 20 '21

What are you having difficulty learning or are currently struggling to learn?

I'm curious what the community here has difficulty with when it comes to learning Python. Partly because I want to see if the more experienced community here (or myself) can help point you into the right direction. . . but also because I'm trying to come up with video tutorial ideas for future content and would love to hear from Python learners what would be most useful to dedicate our time on.

I'm looking forward to hearing what you guys have to say!

417 Upvotes

324 comments sorted by

View all comments

Show parent comments

2

u/MaraudingAvenger Feb 21 '21

So, you may already know, but just in case: Python, that we're using to interpret the stuff we're coding in text files into instructions for the CPU to execute, is a program written in C. There are other implementations of python -- Jython, Cython, and others -- that are written in other languages and serve other purposes. The big thing is that Python is just an interpreter that takes text strings, evaluates what those mean, does a thing, and then reads in the next string.

There are many libraries that are written in C, and then provide Python an API to use to talk to the C code. Pandas and numpy are examples of these. The big deal about some of these packages is that they need to compile to be usable; i.e. you need glibc so that python can use some of the basic C functions that it needs to interact with the linux distro that you're including in your docker image.

It's also possible to write your own C extensions for Python, and there's a pretty thorough explanation of how to do it in the python documentation. You don't need to read/understand all of that -- just know that the code you're typing by itself is not something a computer will know how to run; the python interpreter does all of the translating between your code and machine code based on a set of instructions written in C.

2

u/jiavlb Feb 22 '21

Thank you for such a detailed explanation. This helps..