[Python-ideas] Return for assignment blocks
Guido van Rossum
guido at python.org
Thu Oct 25 11:25:04 EDT 2018
On Thu, Oct 25, 2018 at 7:41 AM Calvin Spealman <cspealma at redhat.com> wrote:
> On Thu, Oct 25, 2018 at 9:28 AM Anders Hovmöller <boxed at killingar.net>
>> > The point is not saving a line or typing, but saving a thought.
>> Expressing the intent of the factory function more clearly.
> You know what, I *can't* think of other good examples than slightly
> improved decorators. So, maybe its not that great an idea if it can't be
> applied to at least a few more use cases.
I appreciate that you're saving a thought, and I think it isn't a bad idea.
It is indeed a very common pattern in decorators. But it would be a bit of
a one-trick pony, since there aren't many *other* situations where it's
useful. Compared to decorators themselves (which also, as was pointed out,
do so much more than "saving a line") the use case is just much narrower.
So unless we find more use cases, or until we can convince ourselves that
we can use `def (args): block` in all expression contexts, I guess it'll
have to remain an idea. Thank you though! It was a fascinating one.
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas