3 ms·
>Then let's get rid of the with semantics too, because they add magic. With just runs the enter and exit method of a context manager. Nothing magical about it.
by crdoconnor 10y ago
>Then let's get rid of the with semantics too, because they add magic.
With just runs the enter and exit method of a context manager. Nothing magical about it.
>My point was the "Explicit is better than implicit" means "be clear of your intent". And if I see someone using the attr module (which comes with the standard library), and I'm not familiar with it, I'll read into it.
You don't have to read into 'with' to make an intelligent guess at what the code does. It's meaningful even if you've never heard of context managers.
Unlike this.