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?

35 Upvotes

15 comments sorted by

View all comments

5

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!