@teachmepython.bsky.social
+ Follow
240
followers
130
following
400
posts
Posts
Media
Videos
Starter Packs
teachmepython.bsky.social
@teachmepython.bsky.social
· 2d
For me I am excited to see all these new performance-related improvements, as well as the neat REPL enhancements and more helpful error messages.
teachmepython.bsky.social
@teachmepython.bsky.social
· 2d
What's your favorite new feature in the last couple of releases of
#Python
? 🐍🤔
1
teachmepython.bsky.social
@teachmepython.bsky.social
· 3d
Install the latest
#Python
today with uv:
uv python upgrade 3.14
1
teachmepython.bsky.social
@teachmepython.bsky.social
· 3d
#Python
Tricks
Want to read the Python code of the file you are executing?
Add the following to the end of your script and it will output the entire file to stdout:
1
teachmepython.bsky.social
@teachmepython.bsky.social
· 4d
#Python
3.14 is out now!
🐍 - Free-threading
🐍 - Deferred annotations
🐍 - t-strings
🐍 - ZStandard compression
🐍 - Multi-interpreter support
🐍 - JIT compiler included for Windows and MacOS
🐍 - and more!
1
1
teachmepython.bsky.social
@teachmepython.bsky.social
· 4d
#Python
Pop Quiz 🐍❓
What is the output of the following code?
A) Syntax Error
B) Type Error
C) Case A Found!
D)
1
teachmepython.bsky.social
@teachmepython.bsky.social
· 5d
Need to find the most common number in a sequence with
#Python
? 🐍🔥
The collections module has a great class for that!
1
teachmepython.bsky.social
@teachmepython.bsky.social
· 9d
#Python
Pro Tip - How to flatten a list of lists 🐍🔥
1
teachmepython.bsky.social
@teachmepython.bsky.social
· 10d
Stupid
#Python
trick 🐍🤯
Calling a dunder method directly without using name mangling
teachmepython.bsky.social
@teachmepython.bsky.social
· 12d
#Python
Pop Quic 🐍❓
A) {range}
B) (range)
C) [0, 1, 2]
D) (0, 1, 2)
E) {0, 1, 2}
1
teachmepython.bsky.social
@teachmepython.bsky.social
· 12d
I don't use lambdas very often, but they are very handy in
#Python
when you use the built-in sorted() function
By using a lambda, you can do some cool advanced sorting! 🐍🔥
1
1
6
teachmepython.bsky.social
@teachmepython.bsky.social
· 16d
What have you used
#Python
's case statement for? 🐍❓
If you haven't seen it, here's an example:
teachmepython.bsky.social
@teachmepython.bsky.social
· 16d
#Python
Pop Quiz 🐍❓
What will be the output if you run this code?
A) Outer ZeroDivisionError exception caught
B) Error: You divided by zero!
C) Error: You divided by zero! Finally executed
D) Finally executed
E) None of the above
teachmepython.bsky.social
@teachmepython.bsky.social
· 17d
Need to time how long a short snippet of
#python
code takes to run? Use the timeit module! 🐍🔥
You can also use timeit to time functions and imports!
teachmepython.bsky.social
@teachmepython.bsky.social
· 17d
Here's a silly example of a function factory using
#Python
and lambdas
Normally, you wouldn't use lambdas, but you might have a list of functions or a use a generator to return functions or callables.
teachmepython.bsky.social
@teachmepython.bsky.social
· 22d
Here's some ternary fun with
#Python
🐍🔥
1
teachmepython.bsky.social
@teachmepython.bsky.social
· 22d
How to use
#Python
threads to target specific functions as workers
teachmepython.bsky.social
@teachmepython.bsky.social
· 22d
How often do you use the ternary operator in
#Python
?
Here's an example in case you haven't heard of it:
teachmepython.bsky.social
@teachmepython.bsky.social
· 23d
Have you ever used a generator expression in
#Python
? They are similar to a list comprehension except that you get a generator returned.
Check it out:
2
teachmepython.bsky.social
@teachmepython.bsky.social
· 24d
Function overloading in
#Python
using the functools module! 🐍🔥
teachmepython.bsky.social
@teachmepython.bsky.social
· 25d
You can read his whole write-up here:
benkurtovic.com/2014/06/01/...
teachmepython.bsky.social
@teachmepython.bsky.social
· 25d
One of the craziest lambdas I have ever seen in
#Python
🐍🚀
The obfuscated "Hello World" by Ben Kurtovic
1
1
teachmepython.bsky.social
@teachmepython.bsky.social
· 25d
Have you ever used
#Python
's handy ChainMap collection?
You can use ChainMap to combine dictionaries, among other things:
3
teachmepython.bsky.social
@teachmepython.bsky.social
· 25d
Here's a silly
#Python
trick. 🐍🔥
You can use lambdas to create a simple function dictionary where you can call each function using the key in the dict:
teachmepython.bsky.social
@teachmepython.bsky.social
· 29d
You can get the GitKracken Pro subscription for 50% off here:
gitkraken.cello.so/DnismeH8TmN
GitKraken Legendary Git Tools | GitKraken
Meet GitKraken, the creator of legendary Git tools for developers and teams - like the GitKraken Desktop, with Git GUI and CLI, Git Integration for Jira, and GitLens for VS Code.
gitkraken.cello.so