r/Python • • 18h ago

Daily Thread Sunday Daily Thread: What's everyone working on this week?

10 Upvotes

Weekly Thread: What's Everyone Working On This Week? πŸ› οΈ

Hello r/Python! It's time to share what you've been working on! Whether it's a work-in-progress, a completed masterpiece, or just a rough idea, let us know what you're up to!

How it Works:

  1. Show & Tell: Share your current projects, completed works, or future ideas.

  2. Discuss: Get feedback, find collaborators, or just chat about your project.

  3. Inspire: Your project might inspire someone else, just as you might get inspired here.

Guidelines:

  • Feel free to include as many details as you'd like. Code snippets, screenshots, and links are all welcome.

  • Whether it's your job, your hobby, or your passion project, all Python-related work is welcome here.

Example Shares:

  1. Machine Learning Model: Working on a ML model to predict stock prices. Just cracked a 90% accuracy rate!

  2. Web Scraping: Built a script to scrape and analyze news articles. It's helped me understand media bias better.

  3. Automation: Automated my home lighting with Python and Raspberry Pi. My life has never been easier!

Let's build and grow together! Share your journey and learn from others. Happy coding! 🌟


r/Python • • 10h ago

Discussion Do Python-specific skills actually improve the agentic coding?

0 Upvotes

Hey folks! I’ve been playing with agentic coding and wondering if it’s actually worth adding Python-specific skills to my setup.

For those of you using them: which ones are genuinely useful? Any examples where a Python-specific skill noticeably improved the result vs just letting the agent figure things out on its own?


r/Python • • 1d ago

Daily Thread Saturday Daily Thread: Resource Request and Sharing! Daily Thread

9 Upvotes

Weekly Thread: Resource Request and Sharing πŸ“š

Stumbled upon a useful Python resource? Or are you looking for a guide on a specific topic? Welcome to the Resource Request and Sharing thread!

How it Works:

  1. Request: Can't find a resource on a particular topic? Ask here!

  2. Share: Found something useful? Share it with the community.

  3. Review: Give or get opinions on Python resources you've used.

Guidelines:

  • Please include the type of resource (e.g., book, video, article) and the topic.

  • Always be respectful when reviewing someone else's shared resource.

Example Shares:

  1. Book: "Fluent Python" - Great for understanding Pythonic idioms.

  2. Video: Python Data Structures - Excellent overview of Python's built-in data structures.

  3. Article: Understanding Python Decorators - A deep dive into decorators.

Example Requests:

  1. Looking for: Video tutorials on web scraping with Python.

  2. Need: Book recommendations for Python machine learning.

Share the knowledge, enrich the community. Happy learning! 🌟


r/Python • • 2d ago

Discussion Why doesn't PyCharm warn about this type mismatch?

9 Upvotes

I'm using PyCharm with Python 3.13 and trying to implement a generic CQRS pattern.

I explicitly specify int as the response type, but PyCharm doesn't report any error when the handler returns str.

from abc import ABC, abstractmethod
from typing import Generic, TypeVar

TCommand = TypeVar("TCommand", bound="Command")
TResponse = TypeVar("TResponse")


class Command(ABC, Generic[TResponse]):
    pass


class CommandHandler(ABC, Generic[TCommand, TResponse]):
    @abstractmethod
    async def handle(self, command: TCommand) -> TResponse:
        pass


class CreateUserCommand(Command[int]):
    pass


class CreateUserCommandHandler(CommandHandler[CreateUserCommand, int]):
    async def handle(self, command: CreateUserCommand) -> str:
        return "123"

Is this expected behavior, or am I missing something in my generic type definitions?


r/Python • • 2d ago

Discussion For devs using Claude Code or similar at work: what’s the 10% you still fix by hand in Python?

40 Upvotes

I keep hearing that AI now writes most of the code at some companies. For people actually shipping Python with Claude Code, Cursor or Copilot:

  1. Roughly what share of your merged code starts as AI output?

  2. What do you most often have to correct? Bugs, tests, pandas or data issues, dependencies, design?

  3. Which skills became more important for you, and which became less important?

Context: I work in risk and data and am deciding what to get good at next. Real examples would help more than opinions. Thanks!


r/Python • • 2d ago

Daily Thread Friday Daily Thread: r/Python Meta and Free-Talk Fridays

9 Upvotes

Weekly Thread: Meta Discussions and Free Talk Friday πŸŽ™οΈ

Welcome to Free Talk Friday on /r/Python! This is the place to discuss the r/Python community (meta discussions), Python news, projects, or anything else Python-related!

How it Works:

  1. Open Mic: Share your thoughts, questions, or anything you'd like related to Python or the community.

  2. Community Pulse: Discuss what you feel is working well or what could be improved in the /r/python community.

  3. News & Updates: Keep up-to-date with the latest in Python and share any news you find interesting.

Guidelines:

Example Topics:

  1. New Python Release: What do you think about the new features in Python 3.11?

  2. Community Events: Any Python meetups or webinars coming up?

  3. Learning Resources: Found a great Python tutorial? Share it here!

  4. Job Market: How has Python impacted your career?

  5. Hot Takes: Got a controversial Python opinion? Let's hear it!

  6. Community Ideas: Something you'd like to see us do? tell us.

Let's keep the conversation going. Happy discussing! 🌟


r/Python • • 4d ago Regret

News Tim Peters has passed away

2.4k Upvotes

Tim died July 15, at his home in Ashland, Wisconsin. He was 74. We don't know any specifics yet.

In case you don't know who Tim Peters is, he was an early pioneer in helping shape the Python language and its runtime. He invented a new sorting algorithm ("Timsort"); a descendent of it ("PowerSort") is still used in Python today, as well as in Java, and several Javascript runtimes (Chrome, Node). He dashed off The Zen Of Python in response to a Usenet post asking about best practices. So many things in Python are directly due to Tim. Online, he was funny, charming, helpful, and had a depth of knowledge and wisdom that was frankly unmatched. He'll be missed.

https://www.bratleyfamilyfuneralhomes.com/obituary/timothy-peters


r/Python • • 2d ago

Discussion Eventually LLMs will write what will become industry standard python.

0 Upvotes

LLMs are still outputting code that is too sloppy for some engineers. However, there will come a point in the near future where a model can write a "standard" style of code. Style of code is something most python developers recognise, and i wonder if that conversation has started yet.


r/Python • • 3d ago

Discussion 112 CodeQL alerts on my python app, 14 were real

0 Upvotes

HI, i run a long-lived python backend on windows and mac!

it only listens on 127.0.0.1 and almost every route needs an access token. last week i turned on the default CodeQL scan for the first time and got 112 alerts ( 112 β†’ 1 critical, 87 high, 24 medium).

i went through them one by one with a single question: can this value come from text someone else wrote (a web page, a downloaded file, model output)? where an alert described an attack input, i actually fed it in and timed it.

the first one that surprised me was the regex that checks whether a downloaded file is html. `<!--\` followed by \`--><!--` 28 times kept it busy for 27 seconds. two more regexes that read text we didn't write did the same thing (22s and 11s). six alerts in that family were real. after the fix the html check runs 5,000 times in 0.003s.

the one i'm most embarrassed about: to see whether a login had finished, i checked whether the url contained the site name. so `evil.example/?next=naver.com` passed as a finished login, and `evilnaver.com` counted as the same site. seven alerts across different files. now one small helper pulls out the hostname and checks "equal, or ends with `.domain`", and all seven places use it. the last real one was a script tag filter that let `</script foo>` through.

every fix got a test, and i checked that the test fails when the fix is taken out.

the other 98 i dismissed with a one-line reason each. 42 of them were in my own tests, lines that just write down the url a test expects. most of the rest were path injection or stack trace exposure on routes that need the token anyway. i only traced two of the path ones all the way, so i might be wrong about a couple.

the same "incomplete url substring" rule was noise all 42 times in tests and a real hole in the login check. asking where the value comes from got me through it faster than reading the alert type.

how do you deal with this on a localhost-only or solo project? i dismissed with reasons but i'm not sure that scales.


r/Python • • 3d ago

Daily Thread Thursday Daily Thread: Python Careers, Courses, and Furthering Education!

5 Upvotes

Weekly Thread: Professional Use, Jobs, and Education 🏒

Welcome to this week's discussion on Python in the professional world! This is your spot to talk about job hunting, career growth, and educational resources in Python. Please note, this thread is not for recruitment.


How it Works:

  1. Career Talk: Discuss using Python in your job, or the job market for Python roles.

  2. Education Q&A: Ask or answer questions about Python courses, certifications, and educational resources.

  3. Workplace Chat: Share your experiences, challenges, or success stories about using Python professionally.


Guidelines:

  • This thread is not for recruitment. For job postings, please see r/PythonJobs or the recruitment thread in the sidebar.

  • Keep discussions relevant to Python in the professional and educational context.


Example Topics:

  1. Career Paths: What kinds of roles are out there for Python developers?

  2. Certifications: Are Python certifications worth it?

  3. Course Recommendations: Any good advanced Python courses to recommend?

  4. Workplace Tools: What Python libraries are indispensable in your professional work?

  5. Interview Tips: What types of Python questions are commonly asked in interviews?


Let's help each other grow in our careers and education. Happy discussing! 🌟


r/Python • • 4d ago

Discussion Pydantic in 100 lines

8 Upvotes

The title is obviously tongue in cheek, but in 100 lines we can get a quite a lot done to type-check dataclasses.

https://thibaud.space/2026/10/pydantic-in-100-lines-part-1.html


r/Python • • 5d ago

Meta Consistency of new unpacking syntax in 3.15?

19 Upvotes

Not sure if this question belongs here or if the flair is right, but I have a question.

You can now (3.15 and up, PEP 448) unpack nested lists and dictionaries with * and ** in comprehension expressions, for example:

>>> ranges = [range(i) for i in range(5)]
>>> [*item for item in ranges]
[0, 0, 1, 0, 1, 2, 0, 1, 2, 3]

(Code from PEP)

but I also try to do small checks and this doesn't seem possible:

>>> [b for b in [*a if min(a)<2 else *(a[::-1]) for a in [(1, 2), (3, 4)]] if b%2==0]
  File "<python-input-4>", line 1
    [b for b in [*a if min(a)<2 else *(a[::-1]) for a in [(1, 2), (3, 4)]] if b%2==0]
                                     ^
SyntaxError: cannot unpack only part of a conditional expression

I need junky work around:

[c for c in [*b for b in [a if min(a)<2 else (a[::-1]) for a in [(1, 2, 3), (4, 5, 6)]]] if c%2==0]
[2, 6, 4]

And also having an outside list due to the fact that there is no option to filter the elements the stars unpacks. Any chances this improves with future versions?

Update: thanks for the responses everyone, I think u/latkde explains it very well in their post. Yes in practice I think I can't use this kind of syntax for a while now and be it just get compatibility with older versions, it would be just for my own side projects and quick checks answering math questions online. I was just curios because needing to put an expression in parentheses is not something I am very used to in Python (and try to avoid if I can) and since the previous versions seemed to have relaxed the rules in this regard (or was it just help, exit and quit?) I didn't understand why the expression above wouldn't work.


r/Python • • 5d ago

Discussion Wiimote in Python

6 Upvotes

Im having a ton of trouble trying to get a wiimote's data/Inputs. I've tried wiiuse and cwiid didnt seem to work. Idk if it has smt to do with me being a mac.


r/Python • • 5d ago

Daily Thread Tuesday Daily Thread: Advanced questions

14 Upvotes

Weekly Wednesday Thread: Advanced Questions 🐍

Dive deep into Python with our Advanced Questions thread! This space is reserved for questions about more advanced Python topics, frameworks, and best practices.

How it Works:

  1. Ask Away: Post your advanced Python questions here.

  2. Expert Insights: Get answers from experienced developers.

  3. Resource Pool: Share or discover tutorials, articles, and tips.

Guidelines:

  • This thread is for advanced questions only. Beginner questions are welcome in our Daily Beginner Thread every Thursday.

  • Questions that are not advanced may be removed and redirected to the appropriate thread.

Recommended Resources:

Example Questions:

  1. How can you implement a custom memory allocator in Python?

  2. What are the best practices for optimizing Cython code for heavy numerical computations?

  3. How do you set up a multi-threaded architecture using Python's Global Interpreter Lock (GIL)?

  4. Can you explain the intricacies of metaclasses and how they influence object-oriented design in Python?

  5. How would you go about implementing a distributed task queue using Celery and RabbitMQ?

  6. What are some advanced use-cases for Python's decorators?

  7. How can you achieve real-time data streaming in Python with WebSockets?

  8. What are the performance implications of using native Python data structures vs NumPy arrays for large-scale data?

  9. Best practices for securing a Flask (or similar) REST API with OAuth 2.0?

  10. What are the best practices for using Python in a microservices architecture? (..and more generally, should I even use microservices?)

Let's deepen our Python knowledge together. Happy coding! 🌟


r/Python • • 7d ago

News PyPI's redesigned project pages with clearer security signals are now live

116 Upvotes

https://blog.pypi.org/posts/2026-11-06-ui-updates-complete/

In July, we announced a series of planned updates to the PyPI user interface. Shaped by user research with members of the Python community, the updates aim to improve how we surface security signals and display package details.

We're pleased to share that this work is now complete and live on PyPI.

(full blog post in link)


r/Python • • 6d ago

Daily Thread Monday Daily Thread: Project ideas!

12 Upvotes

Weekly Thread: Project Ideas πŸ’‘

Welcome to our weekly Project Ideas thread! Whether you're a newbie looking for a first project or an expert seeking a new challenge, this is the place for you.

How it Works:

  1. Suggest a Project: Comment your project ideaβ€”be it beginner-friendly or advanced.

  2. Build & Share: If you complete a project, reply to the original comment, share your experience, and attach your source code.

  3. Explore: Looking for ideas? Check out Al Sweigart's "The Big Book of Small Python Projects" for inspiration.

Guidelines:

  • Clearly state the difficulty level.

  • Provide a brief description and, if possible, outline the tech stack.

  • Feel free to link to tutorials or resources that might help.

Example Submissions:

Project Idea: Chatbot

Difficulty: Intermediate

Tech Stack: Python, NLP, Flask/FastAPI/Litestar

Description: Create a chatbot that can answer FAQs for a website.

Resources: Building a Chatbot with Python

Project Idea: Weather Dashboard

Difficulty: Beginner

Tech Stack: HTML, CSS, JavaScript, API

Description: Build a dashboard that displays real-time weather information using a weather API.

Resources: Weather API Tutorial

Project Idea: File Organizer

Difficulty: Beginner

Tech Stack: Python, File I/O

Description: Create a script that organizes files in a directory into sub-folders based on file type.

Resources: Automate the Boring Stuff: Organizing Files

Let's help each other grow. Happy coding! 🌟


r/Python • • 7d ago

Daily Thread Sunday Daily Thread: What's everyone working on this week?

28 Upvotes

Weekly Thread: What's Everyone Working On This Week? πŸ› οΈ

Hello r/Python! It's time to share what you've been working on! Whether it's a work-in-progress, a completed masterpiece, or just a rough idea, let us know what you're up to!

How it Works:

  1. Show & Tell: Share your current projects, completed works, or future ideas.

  2. Discuss: Get feedback, find collaborators, or just chat about your project.

  3. Inspire: Your project might inspire someone else, just as you might get inspired here.

Guidelines:

  • Feel free to include as many details as you'd like. Code snippets, screenshots, and links are all welcome.

  • Whether it's your job, your hobby, or your passion project, all Python-related work is welcome here.

Example Shares:

  1. Machine Learning Model: Working on a ML model to predict stock prices. Just cracked a 90% accuracy rate!

  2. Web Scraping: Built a script to scrape and analyze news articles. It's helped me understand media bias better.

  3. Automation: Automated my home lighting with Python and Raspberry Pi. My life has never been easier!

Let's build and grow together! Share your journey and learn from others. Happy coding! 🌟


r/Python • • 8d ago

Discussion Mysterious Lazy Imports

59 Upvotes

Run this on Python 3.15:

>>> lazy import json
>>> type(globals()['json'])
<class 'lazy_import'>

Now try separating that into an innocent variable:

>>> lazy import json
>>> x = globals()['json']
>>> type(x)
<class 'module'>

Looks like the same code, but what?! The output changes! Can you guess why?

(Originally asked as a Stack Overflow question, now posting here as a fun fact πŸ˜„)


r/Python • • 8d ago

Tutorial Internals of Asyncio

74 Upvotes

This article is a deep dive into the internals of the asyncio Python standard library. It is written from a debugging perspective, stepping through the code line by line.

Article: internals of asyncio


r/Python • • 8d ago

Discussion the faulthandler i turned on to catch crashes was causing them (windows, all_threads=True)

32 Upvotes

i run a long-lived python 3.11 backend on windows 11. at the end of october it died mid-task once with nothing in the logs, so i turned on faulthandler.enable(file=..., all_threads=True) to see where it died next time.

over the next three days it died four times, every time an access violation inside python311.dll. before that, this backend had never crashed like this.

my first suspect was a race: several threads setting restype on the same ctypes function. it looked plausible, so i fixed it. less than two hours later it crashed again.

going back to the log, there were far more dumps than real crashes. 254 in three days, all of them "Windows fatal exception: code 0x80010108". that's the COM "object disconnected" error, a handled and harmless exception. the program kept running fine after each one. from what we saw, faulthandler on windows reacts to these handled exceptions too and writes a dump every time.

all four crashes happened in the middle of writing one of those dumps. the output was cut off halfway through a File "..." line of another thread. my read is that with all_threads=True it was walking the stack of another thread that was still running, and died there. the tool i turned on to find out why the backend died was what was killing it.

●the fix was one line: all_threads=False. it only dumps the current thread, so if a real crash happens its location still gets logged. i also added a test so it can't quietly flip back to True.

●result: since the fix, the same 0x80010108 has fired 245 more times and the backend hasn't crashed once. that's four days on one machine, so not a long run yet. i still don't know what sends the 0x80010108. it comes from a windows thread with no python stack, so i couldn't trace it.

if you keep faulthandler on in a windows app, check whether COM codes like 0x8001xxxx pile up in the dump log. if they do, all_threads=True may be creating that many risky moments for you.

two things i'm curious about. πŸ€”

  1. has a diagnostic or monitoring tool ever caused the bug you were chasing?

  2. and how do you set up faulthandler for long-running python programs on windows?


r/Python • • 8d ago

Daily Thread Saturday Daily Thread: Resource Request and Sharing! Daily Thread

17 Upvotes

Weekly Thread: Resource Request and Sharing πŸ“š

Stumbled upon a useful Python resource? Or are you looking for a guide on a specific topic? Welcome to the Resource Request and Sharing thread!

How it Works:

  1. Request: Can't find a resource on a particular topic? Ask here!

  2. Share: Found something useful? Share it with the community.

  3. Review: Give or get opinions on Python resources you've used.

Guidelines:

  • Please include the type of resource (e.g., book, video, article) and the topic.

  • Always be respectful when reviewing someone else's shared resource.

Example Shares:

  1. Book: "Fluent Python" - Great for understanding Pythonic idioms.

  2. Video: Python Data Structures - Excellent overview of Python's built-in data structures.

  3. Article: Understanding Python Decorators - A deep dive into decorators.

Example Requests:

  1. Looking for: Video tutorials on web scraping with Python.

  2. Need: Book recommendations for Python machine learning.

Share the knowledge, enrich the community. Happy learning! 🌟


r/Python • • 9d ago

Daily Thread Friday Daily Thread: r/Python Meta and Free-Talk Fridays

27 Upvotes

Weekly Thread: Meta Discussions and Free Talk Friday πŸŽ™οΈ

Welcome to Free Talk Friday on /r/Python! This is the place to discuss the r/Python community (meta discussions), Python news, projects, or anything else Python-related!

How it Works:

  1. Open Mic: Share your thoughts, questions, or anything you'd like related to Python or the community.

  2. Community Pulse: Discuss what you feel is working well or what could be improved in the /r/python community.

  3. News & Updates: Keep up-to-date with the latest in Python and share any news you find interesting.

Guidelines:

Example Topics:

  1. New Python Release: What do you think about the new features in Python 3.11?

  2. Community Events: Any Python meetups or webinars coming up?

  3. Learning Resources: Found a great Python tutorial? Share it here!

  4. Job Market: How has Python impacted your career?

  5. Hot Takes: Got a controversial Python opinion? Let's hear it!

  6. Community Ideas: Something you'd like to see us do? tell us.

Let's keep the conversation going. Happy discussing! 🌟


r/Python • • 9d ago

Discussion What will we become in the end?

4 Upvotes

"Is there anything that is hard for AI to do in Python?

To be honest, coding by yourself is fun, but that doesn't matter to the job market. We'll just settle for building our own projects, but it's frustrating to see AI outperform you... And since the job market is being destroyedβ€”and will be destroyed!!β€”by AI, it seems we will end up turning to sabotage and attacking companies if no jobs are available for programmers, especially the Python community..."


r/Python • • 10d ago

News PyCharm 2026.3 released (IDE)

70 Upvotes