Here are some numbers on the size of Python and everything you can learn.
Python ๐ is a huge language:
There's always something to keep you busy! Let me tell you exactly how busy:
Python 3.10 has 71 built-in functions.
The built-in functions are the functions that you can use without having to import anything.
Among them you can find print
or int
...
But also compile
or __import__
.
>>> compile("def f(): return 42", "", "exec")
<code object <module> at 0x0000028A4183CD40, file "", line 1>
>>> __import__("math")
<module 'math' (built-in)>
Python 3.10 has many built-in types and they come with many methods:
And strings?! Don't even get me started on strings. How many methods do you think strings have? Care to take a guess? Drumroll, please...
Strings have 47 methods: capitalize, casefold, center, count, encode, endswith, expandtabs, find, format, format_map, index, isalnum, isalpha, isascii, isdecimal, isdigit, isidentifier, islower, isnumeric, isprintable, isspace, istitle, isupper, join, ljust, lower, lstrip, maketrans, partition, removeprefix, removesuffix, replace, rfind, rindex, rjust, rpartition, rsplit, rstrip, split, splitlines, startswith, strip, swapcase, title, translate, upper, and zfill!
That's a lot of string methods... And these counts I presented exclude things like dunder methods, which are also quite a few... So, learning all of this will take you some time!
There is also the standard library, which is also huge! The Python Standard Library has almost 250 modules! That's why they say Python has โbatteries includedโ... Those are some big batteries! ๐คฃ
Did you know that Python ๐ has over 240 modules in the standard library?
โ Rodrigo ๐๐ (@mathsppblog) August 24, 2021
Here is a MEGA thread ๐งตwith a super high level overview of those modules...
... but before that, I challenge you to name as many modules by heart as possible! ๐ฌ๐
Let's see who gets more!
And if all of this isn't enough, you can always head over to PyPI, the Python Package Index. On PyPI you can find all the packages that people have published for others to use. As of writing this thread, there are 371,830 projects on PyPI! That's a lot of code ๐
So, as you can see, Python really is huge and there is a LOT to learn. In fact, I think you will never learn ALL of it. But that's fine.
In fact, I am of the opinion that mastering Python is impossible, and that's actually OK. The point is not to know it all.
I actually wrote an article a couple of months ago about this subject. In it, I describe how I go about navigating those numbers and always learning something new without suffering from paralysis by analysis: https://mathspp.com/blog/pydonts/why-mastering-python-is-impossible. Go ahead and give that a read!
One of the main takeaways is that you don't need to learn all of Python. You just need to learn a bit and start practising and building things. Then, keep learning, bit by bit, gradually... And you will keep improving ๐
This article was generated automatically from this thread I published on Twitter @mathsppblog. Then it was edited lightly.
+35 chapters. +400 pages. Hundreds of examples. Over 30,000 readers!
My book โPydon'tsโ teaches you how to write elegant, expressive, and Pythonic code, to help you become a better developer. >>> Download it here ๐๐.