[KongchangAI]

#Python

130 related articles

Building a Reliable Polymarket WebSocket Market Monitor in Python
·3 min

Building a Reliable Polymarket WebSocket Market Monitor in Python

A hands-on Python tutorial for building a reliable Polymarket WebSocket market monitor: covering subscriptions, message parsing, staleness protection, exponential backoff reconnection, and heartbeat handling.

Read more →
Complete Guide to Saving and Loading ML Models in Python: joblib, pickle, and Flask Deployment
·2 min

Complete Guide to Saving and Loading ML Models in Python: joblib, pickle, and Flask Deployment

Learn how to save and load ML models in Python using joblib and pickle, compare their tradeoffs, and deploy with Flask. Covers version compatibility and path pitfalls.

Read more →
Python for Beginners: Quickly Integrate AI Capabilities with Free APIs
·2 min

Python for Beginners: Quickly Integrate AI Capabilities with Free APIs

A beginner's guide to AI integration in Python: use free APIs from OpenRouter, Hugging Face, and Google Gemini — no GPU required. Includes a complete code reviewer example, retry logic, and rate limit best practices.

Read more →
How Python's json.dumps Default Parameter Causes Claude to Burn 24% More Tokens
·3 min

How Python's json.dumps Default Parameter Causes Claude to Burn 24% More Tokens

Python's json.dumps defaults to ensure_ascii=True, escaping non-ASCII chars to hex. Embedded in prompts, this causes Claude to burn 24% more tokens and misread Japanese names. Here's the fix.

Read more →
SQLAlchemy 2.1.0 Released: The Continued Evolution of Python's Premier ORM
·1 min

SQLAlchemy 2.1.0 Released: The Continued Evolution of Python's Premier ORM

SQLAlchemy 2.1.0 is out. Explore its place in the Python ecosystem, the 2.x modernization roadmap, Mapped[] type annotations, async support, and upgrade tips.

Read more →
Miso: A Fully Offline Local AI Desktop Pet That Nags You to Go Outside
·2 min

Miso: A Fully Offline Local AI Desktop Pet That Nags You to Go Outside

Miso is a fully offline AI desktop pet running SmolLM2/Qwen2.5 on CPU — no cloud APIs, no subscriptions. Tracks focus time and scolds you to go touch grass.

Read more →
Building a Response Receipt: A Tiny Script to Intercept Blank and Hallucinated AI Output
·2 min

Building a Response Receipt: A Tiny Script to Intercept Blank and Hallucinated AI Output

A Python script under 50 lines freezes AI responses into verifiable JSON receipt cards, automatically intercepting blank output and hallucinated answers with zero dependencies.

Read more →
Core API Skills Every Python Developer Should Master
·2 min

Core API Skills Every Python Developer Should Master

Master the core API skills every Python developer needs: JSON handling, auth, rate limits, error codes on the consumer side, plus building type-safe APIs with FastAPI, Django, and Flask.

Read more →
APSW: The Underrated Advanced Python SQLite Wrapper
·2 min

APSW: The Underrated Advanced Python SQLite Wrapper

APSW (Another Python SQLite Wrapper) fully exposes SQLite's C API to Python. Learn how it differs from sqlite3, when to use it, and whether it fits your project.

Read more →
LLM Response Caching in Practice: Building an Exact-Match Cache for OpenAI-Compatible APIs
·3 min

LLM Response Caching in Practice: Building an Exact-Match Cache for OpenAI-Compatible APIs

How to build a client-side exact-match cache for OpenAI-compatible APIs. Covers cache key design, SQLite & Redis storage, streaming response caching, and request coalescing — with full Python code.

Read more →
Breaking Down a Complete Python Course for Beginners: A Structured Learning Path from Basics to Practice
·2 min

Breaking Down a Complete Python Course for Beginners: A Structured Learning Path from Basics to Practice

A breakdown of a 198-hour Python beginner course on Bilibili — covering its three-stage structure of fundamentals, intermediate, and applied projects, with practical advice for new learners.

Read more →
Writing Python Docstrings with AI: A Practical Guide to Prompts That Actually Work
·2 min

Writing Python Docstrings with AI: A Practical Guide to Prompts That Actually Work

Why pasting code alone gives you mediocre docstrings, and how providing concrete input-output examples boosts AI documentation quality from 30% to 85% usable.

Read more →
Building Model Fallback Chains: When to Switch LLMs and a Python Implementation Guide
·3 min

Building Model Fallback Chains: When to Switch LLMs and a Python Implementation Guide

How to build an LLM model fallback chain under an OpenAI-compatible base URL. Covers when to switch models, which errors should trigger fallback vs. raise immediately, core loop code in Python, and testing strategies.

Read more →
AI Agent Tool Calling in ~12 Lines of Code: Function Calling with Claude and OpenAI
·3 min

AI Agent Tool Calling in ~12 Lines of Code: Function Calling with Claude and OpenAI

Deep dive into Claude and OpenAI Function Calling: implement an Agent loop in ~12 lines of Python with no framework. Covers tool_use vs function_call, Pydantic structured output, and common ID errors.

Read more →
Making Python Undo Functionality Surprisingly Simple with the Memento Pattern
·2 min

Making Python Undo Functionality Surprisingly Simple with the Memento Pattern

Learn how Python's Memento Pattern uses state snapshots to elegantly implement undo/redo. Covers frozen dataclasses, Protocol abstraction, generic History class, and trade-offs vs. Command Pattern.

Read more →
Don't Skip SQL: The Core Skill Every Python Developer Needs
·1 min

Don't Skip SQL: The Core Skill Every Python Developer Needs

SQL is often overlooked by Python learners, yet it's the core skill for accessing data at nearly every company. Learn why Python + SQL is essential for jobs and interviews.

Read more →
The Core Skill Every Python Job Requires: Data Cleaning with Pandas
·1 min

The Core Skill Every Python Job Requires: Data Cleaning with Pandas

Every Python role eventually requires handling messy data. Learn the 5 core Pandas operations — load, filter, create columns, group, and join — to master data cleaning.

Read more →
Crawl4AI Tutorial: Scrape Website Data in Just a Few Lines of Code
·2 min

Crawl4AI Tutorial: Scrape Website Data in Just a Few Lines of Code

Crawl4AI is an open-source AI crawler framework that scrapes websites in just a few lines of code. Learn installation, structured extraction, and LLM integration.

Read more →