#2863: add gen.__name__ and add this name to generator repr().

This commit is contained in:
Georg Brandl 2008-05-15 15:08:32 +00:00
parent b346513044
commit c91210c06b
4 changed files with 49 additions and 3 deletions

View file

@ -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