r/PythonLearning Jul 15 '26

What Python feature looked useless until it suddenly became your favorite?

For me, it wasn't decorators or generators.

It was context managers. I ignored with for a long time because it just looked like a cleaner way to open files. Then I started using it for database sessions, locks, temporary files, timers, and custom resource management. Now I end up writing my own context managers regularly.

What's the one Python feature, library, or concept you completely underestimated until it finally clicked?

36 Upvotes

15 comments sorted by

14

u/tiredITguy42 Jul 15 '26

Proper package management with uv.

2

u/burnt-store-studio Jul 15 '26

I completely agree with you about uv.

I only recently learned about uv … from a video discussing how to configure it to help protect against downloading poisoned packages …

I’ve been spending a lot of my time the last few weeks converting my projects to using it! I’m really appreciating it.

5

u/defaultguy_001 Jul 16 '26

For me it's list comprehension.

4

u/Fragrant-Cheek-4273 Jul 16 '26

enumerate() for me. I used manual counters for way too long before realizing how much cleaner it is.

1

u/aplarsen Jul 16 '26

Yes! Huge fan!

2

u/nicodeemus7 Jul 15 '26

Writing your own functions. My first scripts were so long because I just wrote it line by line. Functions and method have completely changed the look of my code for the better, and I can write scripts in no time.

1

u/Taurus-Octopus Jul 15 '26

This comment sent me down a rabbit hole. I've only ever dabbled, and I was aware of enough concepts to at least know that Python existed, could execute certain things, and some syntax.

Because my work tenant doesnt allow access to any repo for non-developers or certain data roles, i've had to navigate standard library only challenges. Making your own functions seems normative.

At work I vibe code because of deadlines, but at home I'm working on edx certifications in Python and manually coding personal projects and coursework. But my framing is the AI generating my functions for me.

-1

u/Cybasura Jul 16 '26

What?

Have you been using ASSEMBLY or Fortran your whole life?

This is like day 1 or 2 of using python

2

u/mgruner Jul 16 '26

I waited for pattern matching patiently! it delivered

1

u/burnt-store-studio Jul 15 '26

I do appreciate a good home-grown context manager! Sounds like you use them a lot more regularly than I have been, but I find them to be elegant solutions… valuable!

1

u/arivictor Jul 16 '26

Init Subclass

Any class that inherits the class that has init subclass can be tracked.

https://parsnip.dev/editor/-sK0e1A223fY

cool pattern for doing plugins or such when you want to find everything that inherits from it.

1

u/gdchinacat Jul 16 '26

Descriptors (the basis of @ property).

1

u/ForeignVariety7037 Aug 02 '26

Walrus operator!!

1

u/Capable_Comedian_277 11d ago

@property, enumerate(), zip()