James Lu wrote:
as expr [do comma-separated-expressions]:
>    block

means evaluate expr, then call the result of the expression. If do is
present, call it with the argument list after do.

This kind of thing has been proposed before. Although it seems
like a straightforward idea, there are some thorny edge cases
concerning how things like 'return' and 'break' in the code
block should be handled. For example, what should this do:

   def f():
      as g:
         return

Should that return from g or from f?

Or this:

   while some_codition:
      as g:
         if some_other_condition:
            break

If you want to flesh out your proposal you will have to address
these. Also you should seek out previous discussions about code
blocks to make sure you're not just rehashing old ground.

--
Greg




 Otherwise, call it with no
arguments.


If you don't have practical uses, this proposal has ZERO chance of being accepted.


I have already shown a Flask use case and another poster has mentioned they
would find it useful in their own code. (Though they had reservations on
whether it should be included in Python.)

I simply said I wasn’t totally aware of all practical use cases, especially
practical abuse cases. _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct:
http://python.org/psf/codeofconduct/

_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to