Python 3.15.0 (tags/v3.15.0:d220409, Oct 9 2026, 11:55:56) [MSC v.1951 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
DreamPie 1.2.1
>>> i = iter('abc')
>>> next(i)
0: 'a'
>>> next(i)
1: 'b'
>>> next(i)
2: 'c'
>>> next(i)
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
next(i)
~~~~^^^
StopIteration
>>> next(i, 666)
3: 666
>>> next(i)
Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
next(i)
~~~~^^^
StopIteration
>>> def fn():
... print('1')
... yield 'a'
... print('2')
... yield 'b'
... print('3')
... yield 'c'
... print('4')
>>> def f():
... print('abc')
>>> f
4: <function f at 0x000002162F092400>
>>> fn
5: <function fn at 0x000002162E951220>
>>> f()
abc
>>> fn()
6: <generator object fn at 0x000002162EACFB80>
>>> g = fn()
>>> dir(f)
7: ['__annotate__',
'__annotations__',
'__builtins__',
'__call__',
'__class__',
'__closure__',
'__code__',
'__defaults__',
'__delattr__',
'__dict__',
'__dir__',
'__doc__',
'__eq__',
'__format__',
'__ge__',
'__get__',
'__getattribute__',
'__getstate__',
'__globals__',
'__gt__',
'__hash__',
'__init__',
'__init_subclass__',
'__kwdefaults__',
'__le__',
'__lt__',
'__module__',
'__name__',
'__ne__',
'__new__',
'__qualname__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__setattr__',
'__sizeof__',
'__str__',
'__subclasshook__',
'__type_params__']
[About 38 more lines. Double-click to unfold]
>>> dir(fn)
8: ['__annotate__',
'__annotations__',
'__builtins__',
'__call__',
'__class__',
'__closure__',
'__code__',
'__defaults__',
'__delattr__',
'__dict__',
'__dir__',
'__doc__',
'__eq__',
'__format__',
'__ge__',
'__get__',
'__getattribute__',
'__getstate__',
'__globals__',
'__gt__',
'__hash__',
'__init__',
'__init_subclass__',
'__kwdefaults__',
'__le__',
'__lt__',
'__module__',
'__name__',
'__ne__',
'__new__',
'__qualname__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__setattr__',
'__sizeof__',
'__str__',
'__subclasshook__',
'__type_params__']
[About 38 more lines. Double-click to unfold]
>>> dir(g)
9: ['__class__',
'__class_getitem__',
'__del__',
'__delattr__',
'__dir__',
'__doc__',
'__eq__',
'__format__',
'__ge__',
'__getattribute__',
'__getstate__',
'__gt__',
'__hash__',
'__init__',
'__init_subclass__',
'__iter__',
'__le__',
'__lt__',
'__name__',
'__ne__',
'__new__',
'__next__',
'__qualname__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__setattr__',
'__sizeof__',
'__str__',
'__subclasshook__',
'close',
'gi_code',
'gi_frame',
'gi_running',
'gi_state',
'gi_suspended',
'gi_yieldfrom',
'send',
'throw']
[About 38 more lines. Double-click to unfold]
>>> next(g)
1
10: 'a'
>>> next(g)
2
11: 'b'
>>> next(g)
3
12: 'c'
>>> next(g)
4
Traceback (most recent call last):
File "<pyshell#20>", line 1, in <module>
next(g)
~~~~^^^
StopIteration
>>> def fn():
... print('1')
... yield 'a'
... print('2')
... yield 'b'
... print('3')
... return 'Baf!'
>>> g = fn()
>>> next(g)
1
13: 'a'
>>> next(g)
2
14: 'b'
>>> next(g)
3
Traceback (most recent call last):
File "<pyshell#25>", line 1, in <module>
next(g)
~~~~^^^
StopIteration: Baf!
>>>