mirror of
https://github.com/python/cpython.git
synced 2025-07-30 14:44:10 +00:00
#2863: add gen.__name__ and add this name to generator repr().
This commit is contained in:
parent
b346513044
commit
c91210c06b
4 changed files with 49 additions and 3 deletions
|
@ -917,6 +917,17 @@ StopIteration
|
|||
>>> g.gi_code is f.func_code
|
||||
True
|
||||
|
||||
|
||||
Test the __name__ attribute and the repr()
|
||||
|
||||
>>> def f():
|
||||
... yield 5
|
||||
...
|
||||
>>> g = f()
|
||||
>>> g.__name__
|
||||
'f'
|
||||
>>> repr(g) # doctest: +ELLIPSIS
|
||||
'<f generator object at ...>'
|
||||
"""
|
||||
|
||||
# conjoin is a simple backtracking generator, named in honor of Icon's
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue