r/Python • • Feb 26 '26

Discussion Python Android installation

0 Upvotes

Is there any ways to install python on Android system wide ? I'm curious. Also I can install it through termux but it only installs on termux.


r/Python • • Feb 25 '26

Discussion Python Type Checker Comparison: Empty Container Inference

38 Upvotes

Empty containers like [] and {} are everywhere in Python. It's super common to see functions start by creating an empty container, filling it up, and then returning the result.

Take this, for example:

def my_func(ys: dict[str, int]):
  x = {}
  for k, v in ys.items():
    if some_condition(k):
      x.setdefault("group0", []).append((k, v))
    else:
      x.setdefault("group1", []).append((k, v))
  return x

This seemingly innocent coding pattern poses an interesting challenge for Python type checkers. Normally, when a type checker sees x = y without a type hint, it can just look at y to figure out x's type. The problem is, when y is an empty container (like x = {} above), the checker knows it's a dict, but has no clue what's going inside.

The big question is: How is the type checker supposed to analyze the rest of the function without knowing x's type?

Different type checkers implement distinct strategies to answer this question. This blog will examine these different approaches, weighing their pros and cons, and which type checkers implement each approach.

Full blog: https://pyrefly.org/blog/container-inference-comparison/


r/Python • • Feb 25 '26

Tutorial OAuth 2.0 in CLI Apps written in Python

15 Upvotes

https://jakabszilard.work/posts/oauth-in-python

I was creating a CLI app in Python that needed to communicate with an endpoint that needed OAuth 2.0, and I've realized it's not as trivial as I thought, and there are some additional challenges compared to a web app in the browser in terms of security and implementation. After some research I've managed to come up with an implementation, and I've decided to collect my findings in a way that might end up being interesting / useful for others.


r/Python • • Feb 26 '26

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

3 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! 🌟