r/Python • u/django_throwaway_1 • May 29 '18
r/Python • u/FlowAcademic208 • Aug 31 '23
Discussion Do you want to guess what this one-liner does?
So, a colleague of ours has concocted this "brilliant" one-liner. It does get the job done, but it took us a few minutes to understand how exactly. For more context, it is formally a condition to an if statement and l is an index coming from a for loop.
"t" in list(set(itertools.chain.from_iterable([l["s"][i].keys() for i in range(len(l["s"]))])))
r/Python
•
u/JanGiacomelli
•
Jun 10 '26
Discussion What's your approach for breaking changes inside minor version upgrades of your dependencies
For example, FastAPI introduced a breaking change in a minor version upgrade. By default, it started rejecting requests without a Content-Type header. With only the major version pinned, uv lock --upgrade upgrades to the latest version. A similar thing has happened with google-auth-oauthlib. And that's what bit us.
In our case, everything was fine after the upgrade according to the end-to-end test suite, since most modern HTTP clients add the Content-Type header by default. The issue arose when calls were made using some older Java versions. The customer didn't explicitly add the header, so calls were rejected once their cron had started.
Since reading every release note for every dependency is a very dull and time-consuming task, we wrote a Python script that downloads all release notes and added a Claude command to read them, update dependency versions, and update code as required by breaking changes, while keeping the existing state. So far, it's working great.
Anyhow, curious to hear how others are dealing with these things? I assume you're not reading every release note for every dependency?
r/Python • u/Maleficent_Yak_993 • Mar 30 '24
Tutorial remove background from image using AI in just 5 lines of python code
I created a python library "dis-bg-remover" based off the "Highly Accurate Dichotomous Image Segmentation (https://arxiv.org/pdf/2203.03041.pdf), whose results are comparable, if not better, to the premium offerings in the market.
Explainer video here
r/Python • u/[deleted] • Aug 11 '20
Discussion Unpopular opinion: We should stop using the word "pythonic" and citing the Zen of Python as they have lost their meaning
I have used Python for about 10 years and the way the language has changed in that time is somewhat alarming to me (and many other developers I know who started around the same time or earlier). Particularly in past 2-3 years new versions of Python have regularly included features (for e.g. Walrus operator, match syntax in upcoming versions) that clearly violate the Zen of python. Current python code is barely recognizable as python, forget about what was considered as "Pythonic" 10 years ago. Right now effectively whatever black deems as acceptable code is "Pythonic".
r/Python • u/dronedesigner • Apr 14 '23
Discussion How do you guys handle pandas and its sh*tty data type inference
I often like to dump CSVs with 100s of columns and millions of rows into python pandas. and I find it very very frustrating when it gets various data types for columns wrong. nothing helps
including infer_objects().dtypes and convert_dtypes().dtypes
how do you guys auto-detect dtypes for your columns?
is there a better library out there ?
r/Python • u/pragmaticcoders • Nov 23 '15
Learn it Faster: The Entire Python Language in a Single Image
r/Python • u/[deleted] • Mar 11 '25
Discussion cool little dice roller i made
Well its just a random number generator
import
random
def roll():
min_value = 0
max_value = 999
roll = random.randint(min_value, max_value)
return
roll
value = roll ()
print(value) r/Python • u/No_Blackberry_617 • Aug 31 '25
Resource Python type system
(Just sharing something)
As someone who has taken advantage of TypeScript's type safety for most of its career, using Python without type safety feels a bit awkward. I put together a page explaining how to take advantage of Python's type system and how to extend it on your editor.
r/Python • u/crxnamja • Oct 25 '11
What are the best ways to recruit a python developer? I'm getting a bit depressed trying
Background: I help run AppSumo.com.
Been trying to recruit a Python developer for almost a month. Getting a bit depressed. Love any suggestions on where to find the best ones...
r/Python • u/kracekumar • May 15 '12
Functional Programming HOWTO — Python v3.1.5 documentation
docs.python.orgr/Python • u/blackheartredeye • Jul 11 '21
Tutorial QR Code In 4 lines of Python Code (Create / Read)
r/Python • u/bumblechuckle • Oct 28 '14
Hello, please post your offbeat/oddball/absurd open source python repos.
Searching github isn't bring up much and I'm sure there must be some interesting ones. Thanks!
r/Python • u/noPTSDformePlease • Dec 17 '17
pipenv is the worst
<rant>
so I've been using pipenv recently on a new project because its the recommended virtualenv for new heroku python django projects.
let me just say that it never works, its slow, and it is super frustrating. (i'm on a windows 10 system)
its a downgrade from virtualenv (i know that pipenv uses virtualenv under the hood, but it certainly doesn't work nearly as well)
there is no visual indicator that i'm in a pipenv shell.
it randomly decides to deload my requirements halfway through a dev session
it doesn't register input properly when i'm trying to login to the heroku CLI
it hangs frequently
it is SO SLOW ITS RIDICULOUS
it randomly switches between python2 and python3, and i have to keep resetting the PATH variables.
I mean, I've got a lot of respect for pipenv's creator, hes the same guy who made the requests package. The guy is great and a superb python guy.
BUT PIPENV SUCKS TOTAL BALLS.
</rant>
r/Python • u/eleitl • Jul 31 '12
Learn to Program: The Fundamentals - Behind every mouse click and touch-screen tap, there is a computer program that makes things happen. This course introduces the fundamental building blocks of programming and teaches you how to write fun and useful programs using the Python language.
r/Python • u/jomidosan • Sep 13 '13
Miloslav Trmač, -1 for Structured Logging
carolina.mff.cuni.czr/Python • u/st_ve • Jun 23 '17
Wicked! Brython as Javascript alternative? Lovely!!!
brython.infor/Python • u/JewishIGuess • Jun 08 '15
Installing Numpy is not working
I have 64-bit windows, python 3.4, and I need to install numpy. I've downloaded it from multiple sources, and followed multiple sets of instructions. But anything I do in the command prompt throws an error, either from pip for from the file location where numpy is.
Could somebody walk me through, step by step by step, what to do to install numpy? It would be greatly appreciated.
r/Python • u/woahdotcom • May 25 '19
Python Books You Should Read in 2019
r/Python • u/xikly • Aug 11 '15
Do I need to know algortithms?
As the title says, do I need to learn basic sorting & other algorithms to be able to get a job? Are they hard to learn? Does they make a difference in performance?
Also, when I'll need to use some special algo?
r/Python • u/[deleted] • Nov 24 '14
How would I make a reply bot for youtube?
Say I want to comment on youtube with a bot how would I do that? and if that is possible could i get the program to email when I get a reply or pm on the bots account?
[EDIT] I need it to filter words like if "Ninja" is in the title I need it to reply with shibe or something =)
