[issue29471] AST: add an attribute to FunctionDef to distinguish functions from generators and coroutines

2018-09-19 Thread STINNER Victor


STINNER Victor  added the comment:

> I'm not sure we need this feature TBH.

Ok, I close the issue.

--
resolution:  -> wont fix
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29471] AST: add an attribute to FunctionDef to distinguish functions from generators and coroutines

2017-03-15 Thread Mateusz Bysiek

Changes by Mateusz Bysiek :


--
nosy: +mbdevpl

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29471] AST: add an attribute to FunctionDef to distinguish functions from generators and coroutines

2017-03-03 Thread Yury Selivanov

Yury Selivanov added the comment:

I'm not sure we need this feature TBH.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29471] AST: add an attribute to FunctionDef to distinguish functions from generators and coroutines

2017-03-03 Thread Rishav Kumar

Rishav Kumar added the comment:

I'd like to work on this issue.

--
nosy: +aptrishu

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29471] AST: add an attribute to FunctionDef to distinguish functions from generators and coroutines

2017-02-07 Thread Vedran Čačić

Vedran Čačić added the comment:

I remember the message from Guido, long time ago when the syntax of generators 
was discussed. He said he has a hunch that new keyword will not be necessary, 
that the presence of yield will be enough. It'd be interesting to see if he has 
changed his mind, or he has some other excuse about async being fundamentally 
different. :-)

--
nosy: +veky

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29471] AST: add an attribute to FunctionDef to distinguish functions from generators and coroutines

2017-02-07 Thread STINNER Victor

New submission from STINNER Victor:

Currently, symtable_visit_expr() has browse into the AST tree to look up yield, 
yield from or await to check if a function is a generator or a coroutine. If we 
choose to start to work on AST optimizers, I would suggest to add an attribute 
to ast.FunctionDef to announce if a function is a generator or a coroutine.

Currently, the peephole optimizer is unable to remove the deadcode, because 
otherwise the function is no more detected as a generator:

def generator():
  if 0: yield  # "hack" to get a generator
  pass

By the way, it would be nice to add a keyword similar to "async def" to be able 
to explicitly "document" generators as generators, and avoid the "if 0: yield" 
hack, but that's a different topic ;-) I feel less confortable to modify the 
Python language.

--
components: Interpreter Core
messages: 287216
nosy: haypo, inada.naoki, yselivanov
priority: normal
severity: normal
status: open
title: AST: add an attribute to FunctionDef to distinguish functions from 
generators and coroutines
type: enhancement
versions: Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com