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.
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.
The 2025 Hacker Initiative grant cycle is open. Apply here 👉 hackerinitiative.org/apply-now/ Signal boost appreciated.
The 2025 Hacker Initiative grant cycle is open. Apply here 👉 hackerinitiative.org/apply-now/ Signal boost appreciated.
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
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
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__? 💡👇
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__? 💡👇
alias python=uvx python
In my last article.
It does seem overkill.
But there is logic to the madness:
alias python=uvx python
In my last article.
It does seem overkill.
But there is logic to the madness:
For some, sending words might be a small risk that builds momentum for further action.
Here's how I finally did it.
whitep4nth3r.com/blog/how-to-...
Here's how I finally did it.
whitep4nth3r.com/blog/how-to-...