Python Peak

@PythonPeak
15 Followers
0 Following
257 Posts
Quick Python chats, ideas, and tips to level up your coding

How to Prevent Star Unpacking From Eating All Memory

Using *rest to unpack a generator forces the ENTIRE generator into a list in memory. Millions of items at once.

#python #unpacking #generator #memory #performance #howto #production #staroperator

https://www.youtube.com/watch?v=L6UvykBVUfQ

How to Prevent Star Unpacking From Eating All Memory #python

YouTube

Indentation vs Braces: THE HOLY WAR of Programming!

Python's mandatory indentation vs JavaScript's braces - which syntax wins? MOST CONTROVERSIAL!

#python #javascript #pythonvsjs #indentation #braces #syntaxstyle #codeformatting #viralcoding #programmingdebate #holywar #mindblown #controversial

https://www.youtube.com/watch?v=8TtaYmL2TTE

Indentation vs Braces: THE HOLY WAR of Programming! #holywar

YouTube
Python vs JS Ticketing Replay Gate #viralcoding

YouTube

Decorator Order Executes Route BEFORE Auth Check?!

DECORATOR DISASTER! Apply bottom-to-top! Route runs BEFORE auth! Non-admin deletes 847 users! Cannot recover! $4.7M data loss! €2.7M GDPR fine! Security team FIRED!

#python #pythondisaster #decoratororder #authenticationbypass #routesecurity #productionbug #pythonshorts #pythonwtf #adminaccess #careerending #gdpr #flask

https://www.youtube.com/watch?v=8hBZoqogJP0

Decorator Order Executes Route BEFORE Auth Check?! #Flask

YouTube

What's wrong with this Python streaming response?

What's wrong with this Python streaming response in an API. The Python code closes the database cursor before the generator is consumed, so the stream fails mid response. In Python services this causes partial downloads.

#whatswrongwiththispythoncode #pythonbug #pythonproductionbug #pythondebugging #pythonbackend #pythoncodereview #pythonmistake #pythonbestpractices #pythonreliability #pythonincid...

https://www.youtube.com/watch?v=MqjVyD53Uic

Whats wrong with this Python streaming response? #pythondataloss

YouTube

Why does this Python asyncio task run on wrong loop?

Why does this Python asyncio task run on wrong loop in a multi-loop app. The Python code creates a task from a thread without passing the loop. In Python services this schedules on the wrong event loop.

#whatswrongwiththispythoncode #pythonbug #pythonproductionbug #pythondebugging #pythonbackend #pythoncodereview #pythonmistake #pythonbestpractices #pythonreliability #pythonincident #pythonapi ...

https://www.youtube.com/watch?v=1_tED3YnL-8

Why does this Python asyncio task run on wrong loop? #whatswrongwiththispythoncode

YouTube

How to Stop dict.fromkeys From Sharing Lists

fromkeys can point every key to the same list.

#python #dictfromkeys #sharedstate #bug #howto #lists

https://www.youtube.com/watch?v=UA72HQuTLP0

How to Stop dict.fromkeys From Sharing Lists #bug

YouTube

Web Network Vertical

8 rings with 24 spokes create a massive spider web! Python weaves this intricate network pattern! 🕸️✨

#python #pythontricks #turtlegraphics #spiderweb #radialpattern #webnetwork #concentricrings #spokespattern #naturegeometry #pythoncircles #symmetricalweb #networkstructure

https://www.youtube.com/watch?v=-fxnRdWdsKk

Web Network Vertical #concentricrings

YouTube

How to Create a Dict From Two Lists Instantly

dict(zip(keys, vals)). One line. No loop. Most forget this.

#python #dict #zip #oneline #howto

https://www.youtube.com/watch?v=ZJnpgxi4cNw

How to Create a Dict From Two Lists Instantly #zip

YouTube

What's wrong with this Python cache read?

What's wrong with this Python cache read in a quota service. The Python code treats falsey values as a cache miss, so real zeros keep hitting the database. In production Python APIs this explodes traffic and latency when quotas are exhausted.

#whatswrongwiththispythoncode #pythonbug #pythonproductionbug #pythondebugging #pythonbackend #pythoncodereview #pythonmistake #pythonbestpractices #pythonreliabilit...

https://www.youtube.com/watch?v=e2xIU-tgPH4

Whats wrong with this Python cache read? #whatswrongwiththispythoncode

YouTube