mikematt.bsky.social
@mikematt.bsky.social
Reposted
Don't use `.split("\n")` in Python.

Do you want to split a string into its lines?

Use the string method `.splitlines`.

This method is more robust because it'll handle carriage returns from Windows-style newlines.
April 29, 2025 at 1:38 PM
Reposted
Hackers, educators, tinkerers:
The 2025 Hacker Initiative grant cycle is open. Apply here 👉 hackerinitiative.org/apply-now/ Signal boost appreciated.
Application Process
hackerinitiative.org
April 16, 2025 at 6:59 AM
Reposted
Rigged up a thing so my kid can change the color of her bedroom using her marker set!
April 4, 2025 at 9:11 PM
Reposted
List vs Generator in Python 🐍💡

List: 835MB, 0.99s
Generator: 192B, 0.00s 😲

• Use `sys.getsizeof()` to check memory.
• Use generators when you don’t need all values at once.

Small change, big difference! 📈

#Python #tips #performance
March 20, 2025 at 7:59 AM
Reposted
🐍 #Python Tip: Save memory with `__slots__` 🚀

Instead of a dynamic `__dict__`, it defines a static structure, preventing new attributes but saving significant memory. 💡

w1.a = 1 ✅
w2.a = 1 ❌ (AttributeError)

📌 Check the image for full code & memory comparison below.

Have you used __slots__? 💡👇
February 26, 2025 at 12:16 PM
Reposted
Hundreds of Beavers is Looney Tunes meets Alone.
February 23, 2025 at 10:45 PM
Reposted
Linus secret power is cutting through the bullshit. lore.kernel.org/rust-for-lin...
February 23, 2025 at 11:16 AM
Reposted
Some people were surprised I do:

alias python=uvx python

In my last article.

It does seem overkill.

But there is logic to the madness:
February 21, 2025 at 10:29 AM
Reposted
Did you know that by adding `__enter__` and `__exit__` to a class, you can turn it into a context manager? 💡

Here’s an example where a transaction automatically rolls back if the balance goes negative—ensuring safer operations. 🚀

#python #tips
February 18, 2025 at 5:21 PM
Reposted
One of our supporters shared this with us—people are getting creative tonight!
February 14, 2025 at 4:25 AM
Reposted
looking back, AOL had it right. 30 hours of internet per month was the right amount.
February 13, 2025 at 5:21 PM
Reposted
Python 3.14.0a5 is out today in uv 0.5.31 and includes a new tail calling interpreter which, from some quick benchmarks, looks like a 1.23x performance improvement !
February 12, 2025 at 10:37 PM
Reposted
Going from learning by building and making things work to following courses again has opened my eyes to how there’s more than one way to do most things, and even though something works doesn’t mean it’s the best or most efficient way to tackle a problem.
February 12, 2025 at 4:00 PM
Reposted
I went to a training on homeless outreach from a trusted org yesterday, and this is a great option for Americans who want to do something irl but can't risk detainment, so let me share what I learned! 🧵
There are a lot of us who are not well-positioned for street activism (in my case, I can't risk detainment because my youngest still mostly depends on breast milk for calories), and discounting work that can be done on digital space isn't just inaccurate, it's shaming of vulnerable people
I have a client stewing in shame about not doing enough to counter anti-trans and fascist actions, paralyzing himself by saying that no action is good enough except for the one he is too socially anxious to do.

For some, sending words might be a small risk that builds momentum for further action.
February 9, 2025 at 3:55 PM
Reposted
"Start a newsletter" was on my todo list for 3.5 years.

Here's how I finally did it.

whitep4nth3r.com/blog/how-to-...
How I created a newsletter I actually enjoy writing
Send what you like to receive, make it easy for yourself, and do it for the love. Here's how I designed my weekly newsletter to make it a joy to send each week.
whitep4nth3r.com
February 6, 2025 at 11:10 AM
Reposted
🚀 AWS Lambda Developers, take note! AWS just leveled up local development with powerful enhancements for VS Code users. Let's break it down! 🧵👇
February 5, 2025 at 2:01 PM
Reposted
of course they built it

lumon-industries.com
February 1, 2025 at 10:34 PM