Python Tip: bisect for Sorted Insert
import bisect
scores = [60, 70, 80, 90]
bisect.insort(scores, 75)
# [60, 70, 75, 80, 90] — O(log n) search
bisect module maintains sorted lists efficiently. O(log n) search + O(n) insert beats O(n log n)...
https://raccoonette.gumroad.com/l/Python-for-Beginners-From-Zero-to-Your-First-Projects
#Python #CodingTips #Programming
Python Tip: os.scandir() Speed
import os
# 20x faster than os.listdir() for stat operations
for entry in os.scandir('/path'):
if entry.is_file():
print(entry.name, entry.stat().st_size)
os.scandir() caches file metadata during iteration. Up to 20x faster than listdir() + stat() calls.
https://raccoonette.gumroad.com/l/Python-for-Beginners-From-Zero-to-Your-First-Projects
#Python #CodingTips #Programming
Need to know what #Python packages you have installed using uv?
You can try this command:
uv pip list
You should see something like this:

A file you're loading into #Python #Pandas uses weird strings for missing values? Use the na_values parameter in read_* methods:
pd.read_csv(f, na_values='.')
pd.read_csv(f, na_values=['.', '*']) # multiple
pd.read_csv(f, na_values={'a':'.', 'b':'*'}) # per column

Does the concept behind #python #httpx.Auth make sense?
Auth instances are responsible for setting up an Authorization header (or equivalent) but in some cases they might need to refresh their tokens or make other HTTP requests. httpx facilitates this by making Auth instances generators, and treating all but last yielded values as auth-related requests, and only the last one is the authorized user request.
Except I haven’t seen a library using this mechanism - all of them have their own inner httpx.Client instances
How to Stop Float Equality Bugs
0.1 + 0.2 is not 0.3 in Python.
#python #float #precision #bug #howto #math
https://www.youtube.com/watch?v=dzMOOFhL3X0
More observations about checked vs. unchecked exceptions and why unchecked exceptions should not be called "exception". I rather suggest "explainer". Thy explain why an operation could not be performed.
https://miamao.de/blog/2026-02/23.When_is_an_Exception_an_Exception.html
#exception #uncheckedException #Java #TypeScript #Python #Rust
🤖 Agentic AI with multi-model framework using Hugging Face smolagents on AWS
Hugging Face smolagents is an open source Python library designed to make it straightforward to build and run agents using a few lines of code. We will show you how to build an agentic AI solution ...
📰 Source: Artificial Intelligence
🔗 Link: https://aws.amazon.com/blogs/machine-learning/agentic-ai-with-multi-model-framework-using-hugging-face-smolagents-on-aws/
#AI #ArtificialIntelligence #Python
Run a SQL query twice. Get different row orders. That's not a bug.
Databases optimize execution based on indexes, data volume, and memory. Those optimizations can change between queries.
If order matters, you need ORDER BY. And here's where SQL beats Python: mixed sort directions in one line.
ORDER BY signup_date DESC, name ASC
In Python, that requires cmp_to_key or multiple sorting passes. SQL handles it cleanly.
https://jamalhansen.com/blog/order-by-sorting-your-results
#SQL #Python #DuckDB #DataScience #Programming
AG (Retrieval Augmented Generation) is the solution. Here's how to build your own RAG server from scratch using ollama, Open WebUI and Chroma DB!
✅ Document processing ✅ Vector embeddings ✅ Smart retrieval ✅ Production-ready API
#RetrievalAugmentedGeneration #RAG #AIEngineering #LLM #Python #TTMO #OpenSource #AI
I walk through the Python Install Manager for Windows (pymanager). If you have older Python solutions, you should first:
1. Note of the Python versions associated with them.
2. Uninstall the python instals.
After install pymanager and if need be, recreate the venv.
Leave comment for tutorial.
#TTMO #python #PythonInstallManager #PythonOnWindows #pyManager
posit::conf(2026) call for talks may be over, but there are still many #RStats & #Python events where you can submit! Maybe we'll see you there:
🇬🇭 Ghana R Conference (Jul 9-10, Virtual): Feb 25 ghana-rusers.org
🐍 SciPy (Jul 13-19, Minneapolis, MN): Feb 25 pretalx.com/scipy-2026/cfp
