[Python-ideas] Fwd: New suggested built in keyword: do

Jamie Willis jw14896 at my.bristol.ac.uk
Fri Jun 8 10:15:35 EDT 2018


I don't see how this is different to just:

for x in range(50): print(x)
Can you elaborate further?
Jamie

On Jun 8 2018, at 3:12 pm, Randy Diaz <randiaz95 at gmail.com> wrote:
>
> I think that the keyword do would solve problems that occur when people want a simple way to run a command over an iterable but they dont want to store the data.
> example:
>
> do print(x) for x in range(50)
> ---------
> this above command will not return anything and will just run the command that is underlined over a generator. thus running a command comprehension or do comprehension. this will stop people from using the list comprehension to run an iterable through a function when they dont want to return anything. ( Specifically if memory is something we would want to conserve, such as in multithreaded web applications. )
>
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180608/39a4404b/attachment.html>


More information about the Python-ideas mailing list