🐍 Python software developer + coach
📘 Love books/ reading
It keeps business logic separate from the data layer. 📈
Need to swap SQL for CSV or add an API backend later? Plug it in, the interface stays the same.
Example below 👇
It keeps business logic separate from the data layer. 📈
Need to swap SQL for CSV or add an API backend later? Plug it in, the interface stays the same.
Example below 👇
Good reminder: the right data structure saves a lot of code. 🐍
In this case: apart from a small helper function, you get the top stock by symbol using most_common()
Clean, fast, readable. 🚀
Good reminder: the right data structure saves a lot of code. 🐍
In this case: apart from a small helper function, you get the top stock by symbol using most_common()
Clean, fast, readable. 🚀
Bonus tip below: how to un-lambda yourself.
I agree: just write a quick function, more readable + reusable (with the exception of using it inline in common built-ins like `sorted`)
Bonus tip below: how to un-lambda yourself.
I agree: just write a quick function, more readable + reusable (with the exception of using it inline in common built-ins like `sorted`)
This week I learned that uuid now supports v7 and that random + sqlite3 added command-line scripts in recent versions.
This week I learned that uuid now supports v7 and that random + sqlite3 added command-line scripts in recent versions.
And really nice: since 3.12 the uuid module can be executed as a script from the command line 📈 - so with a bit of uv we get to a pretty powerful command 😍 👇
And really nice: since 3.12 the uuid module can be executed as a script from the command line 📈 - so with a bit of uv we get to a pretty powerful command 😍 👇
uv run python -m cProfile -o profile.out -m script_or_package
uv add --dev snakeviz
uv run snakeviz profile.out
(Screenshot: me profiling slow Pandas code as a candidate to refactor using Polars 🔥)
#python #debugging
uv run python -m cProfile -o profile.out -m script_or_package
uv add --dev snakeviz
uv run snakeviz profile.out
(Screenshot: me profiling slow Pandas code as a candidate to refactor using Polars 🔥)
#python #debugging
Great stack for quickly prototyping a front-end, all #Python, no JS 😎
(For more serious web apps you definitely want JS and/or htmlx though 💡)
Great stack for quickly prototyping a front-end, all #Python, no JS 😎
(For more serious web apps you definitely want JS and/or htmlx though 💡)
📄 Write text in latin-1 ➡️ try to read as utf-8 ➡️ 💥 UnicodeDecodeError.
👨💻 Solution:
📄 Write text in latin-1 ➡️ try to read as utf-8 ➡️ 💥 UnicodeDecodeError.
👨💻 Solution:
• Ignore 𝘃𝗮𝗹𝘂𝗲𝘀 when unpacking
• Loop 𝗽𝗹𝗮𝗰𝗲𝗵𝗼𝗹𝗱𝗲𝗿
• Access 𝗹𝗮𝘀𝘁 𝗿𝗲𝘀𝘂𝗹𝘁 in REPL
• Format 𝗹𝗮𝗿𝗴𝗲 𝗻𝘂𝗺𝗯𝗲𝗿𝘀
• Define "𝗽𝗿𝗶𝘃𝗮𝘁𝗲" methods (convention)
See below 👇
• Ignore 𝘃𝗮𝗹𝘂𝗲𝘀 when unpacking
• Loop 𝗽𝗹𝗮𝗰𝗲𝗵𝗼𝗹𝗱𝗲𝗿
• Access 𝗹𝗮𝘀𝘁 𝗿𝗲𝘀𝘂𝗹𝘁 in REPL
• Format 𝗹𝗮𝗿𝗴𝗲 𝗻𝘂𝗺𝗯𝗲𝗿𝘀
• Define "𝗽𝗿𝗶𝘃𝗮𝘁𝗲" methods (convention)
See below 👇
Here's an example how we can remove or update tags, casting new + old into sets, then performing 𝘴𝘦𝘵 𝘰𝘱𝘦𝘳𝘢𝘵𝘪𝘰𝘯𝘴 🔥
Have you used them, how? 😍
(Still on the fence about 𝘸𝘢𝘭𝘳𝘶𝘴, but couldn't bear doing 𝘴𝘵𝘳𝘪𝘱() twice 😅)
Here's an example how we can remove or update tags, casting new + old into sets, then performing 𝘴𝘦𝘵 𝘰𝘱𝘦𝘳𝘢𝘵𝘪𝘰𝘯𝘴 🔥
Have you used them, how? 😍
(Still on the fence about 𝘸𝘢𝘭𝘳𝘶𝘴, but couldn't bear doing 𝘴𝘵𝘳𝘪𝘱() twice 😅)
In the example below, we first use 𝘛𝘦𝘮𝘱𝘰𝘳𝘢𝘳𝘺𝘋𝘪𝘳𝘦𝘤𝘵𝘰𝘳𝘺 to create 5 temp files.
This is a great example of using a 𝗰𝗼𝗻𝘁𝗲𝘅𝘁 𝗺𝗮𝗻𝗮𝗴𝗲𝗿 — a clean way to automatically clean up resources.
pytest makes it even easier using the 𝘵𝘮𝘱_𝘱𝘢𝘵𝘩 fixture:
In the example below, we first use 𝘛𝘦𝘮𝘱𝘰𝘳𝘢𝘳𝘺𝘋𝘪𝘳𝘦𝘤𝘵𝘰𝘳𝘺 to create 5 temp files.
This is a great example of using a 𝗰𝗼𝗻𝘁𝗲𝘅𝘁 𝗺𝗮𝗻𝗮𝗴𝗲𝗿 — a clean way to automatically clean up resources.
pytest makes it even easier using the 𝘵𝘮𝘱_𝘱𝘢𝘵𝘩 fixture:
That’s what we coach in our 6-week cohort starting next month.
Real apps. Real feedback. Real growth. 💪
More info: pybitescoaching.com
That’s what we coach in our 6-week cohort starting next month.
Real apps. Real feedback. Real growth. 💪
More info: pybitescoaching.com
"𝙄 𝙘𝙖𝙢𝙚 𝙛𝙤𝙧 𝙩𝙝𝙚 𝙨𝙥𝙚𝙚𝙙, 𝙗𝙪𝙩 𝙨𝙩𝙖𝙮𝙚𝙙 𝙛𝙤𝙧 𝙩𝙝𝙚 𝙨𝙮𝙣𝙩𝙖𝙭" 😍
I see why now — it's 𝗯𝗲𝗮𝘂𝘁𝗶𝗳𝘂𝗹 and 𝗳𝗮𝘀𝘁. 📈
Switched from Pandas?
What’s been your biggest win (or pain)? 🤔
#Python #Rust #DataAnalytics
"𝙄 𝙘𝙖𝙢𝙚 𝙛𝙤𝙧 𝙩𝙝𝙚 𝙨𝙥𝙚𝙚𝙙, 𝙗𝙪𝙩 𝙨𝙩𝙖𝙮𝙚𝙙 𝙛𝙤𝙧 𝙩𝙝𝙚 𝙨𝙮𝙣𝙩𝙖𝙭" 😍
I see why now — it's 𝗯𝗲𝗮𝘂𝘁𝗶𝗳𝘂𝗹 and 𝗳𝗮𝘀𝘁. 📈
Switched from Pandas?
What’s been your biggest win (or pain)? 🤔
#Python #Rust #DataAnalytics
✅ Typer
✅ clean code
✅ testing
✅ real end-to-end project
We’ve coached 100s of devs 1:1 — now bringing that magic to our new cohort programs 🎉
🔗 pybitescoaching.com
✅ Typer
✅ clean code
✅ testing
✅ real end-to-end project
We’ve coached 100s of devs 1:1 — now bringing that magic to our new cohort programs 🎉
🔗 pybitescoaching.com
#AI tools: quick wins, but more + longer debugging?
(image source: www.reddit.com/r/Programmer...)
#AI tools: quick wins, but more + longer debugging?
(image source: www.reddit.com/r/Programmer...)
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
Simple, fast book tracking that incentivizes you to keep #reading 😎
Gamified, clean design (Tailwind + Htmx 🙏), and loved by users already. 😍
Let’s keep #books alive 💡, especially in this day and age. 📈
Try it → pybitesbooks.com 📚
Simple, fast book tracking that incentivizes you to keep #reading 😎
Gamified, clean design (Tailwind + Htmx 🙏), and loved by users already. 😍
Let’s keep #books alive 💡, especially in this day and age. 📈
Try it → pybitesbooks.com 📚