Erik (@erikyan) header
Erik (@erikyan) profile picture

Writer, Python instructor. Learn Python @ https://nitter.gq/t.co/chZZ9TnCVF

Amsterdam, The Netherlands
Joined February 2009
Photo by Erik (@erikyan)Photo by Erik (@erikyan)Photo by Erik (@erikyan)Photo by Erik (@erikyan)Photo by Erik (@erikyan)Photo by Erik (@erikyan)Photo by Erik (@erikyan)Photo by Erik (@erikyan)Photo by Erik (@erikyan)Photo by Erik (@erikyan)
RT @Rainmaker1973: It's called visual hyerarchy
305
277
Python has some pretty nifty string functions. Here are some examples!
1
2
17
1,563
Want to swap two variables? Python makes it incredibly easy thanks to tuple unpacking! a = 5 b = 10 a, b = b, a
8
968
With Pyenv, you can start using Python 3.12 right away since they've added it to their list of supported versions as soon as it came out. Learn more about Pyenv here 👇 python.land/virtual-environm…
1
1
787
💡 Do you know #Python’s any() and all() functions? These are powerful tools for evaluating iterables! any() returns True if at least one element of an iterable is true. all() returns True only if all elements of an iterable are true.
1
2
714
👀 Use Python’s built-in help() function! It's an interactive way to explore documentation and learn more about Python objects and modules in the Python REPL! 📚 Examples: help(str) import os help(os) help(os.path) etc.
1
1
578
One notable change: you can use the same quotes inside a nested f-string: >>> f"Quotes inside a nested f-string: {"a string"}" 'Quotes inside a nested f-string now: a string' I'm not sure what to think of this yet...
1
289
Another notable thing is using a per-interpreter GIL. The GIL ensures there is only one thread running at any time. Because only one thread can run at a time, using multiple processors with threads is impossible right now. Read more here: docs.python.org/3.12/whatsne…
262
🤖 Python #Trivia: The name 'Python' was not derived from the snake but from the British comedy series 'Monty Python’s Flying Circus'! 📺 What's your favorite Python fun fact? 🧠 #PythonProgramming #DidYouKnow
1
2
248
What does the teams variable look like after this? #Python #quiz
488
TIL about math.isclose() to compare floating-point numbers in #Python I already knew about pytest's approx() which is similar, but turns out the Standard Library has you covered once more: x = 0.1 + 0.2 print(x == 0.3) # False 😱 # need a small tolerance import math print(math.isclose(x, 0.3)) # True So math.isclose() checks whether two numbers are close enough to each other, within a given tolerance, avoiding the pitfalls of floating-point comparison. #tips #pythonprogramming
2
6
2
53
17,963
Optimus can now sort objects autonomously 🤖 Its neural network is trained fully end-to-end: video in, controls out. Come join to help develop Optimus (& improve its yoga routine 🧘) → tesla.com/AI
2,554
7,106
3,040
32,963
14,218,103
After a few years of using Windows + Linux (dual boot), I returned to MacOS (Macbook Pro). Do you have any tips, tricks, or cool software I need to know about as a software developer?
3
2
393
What's the output of this code? Leave your answer in the comments! #Python #quiz
2
1
6
483