Python 3.12.6 (tags/v3.12.6:a4a2d2b, Sep 6 2024, 20:11:23) [MSC v.1940 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
DreamPie 1.2.1
>>> for x in 'abeceda':
... print(x)
a
b
e
c
e
d
a
>>> it = iter('abeceda')
>>> it
0: <str_ascii_iterator object at 0x000001CD4AE775B0>
>>> dir('abeceda')
1: ['__add__',
'__class__',
'__contains__',
'__delattr__',
'__dir__',
'__doc__',
'__eq__',
'__format__',
'__ge__',
'__getattribute__',
'__getitem__',
'__getnewargs__',
'__getstate__',
'__gt__',
'__hash__',
'__init__',
'__init_subclass__',
'__iter__',
'__le__',
'__len__',
'__lt__',
'__mod__',
'__mul__',
'__ne__',
'__new__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__rmod__',
'__rmul__',
'__setattr__',
'__sizeof__',
'__str__',
'__subclasshook__',
'capitalize',
'casefold',
'center',
'count',
'encode',
'endswith',
'expandtabs',
'find',
'format',
'format_map',
'index',
'isalnum',
'isalpha',
'isascii',
'isdecimal',
'isdigit',
'isidentifier',
'islower',
'isnumeric',
'isprintable',
'isspace',
'istitle',
'isupper',
'join',
'ljust',
'lower',
'lstrip',
'maketrans',
'partition',
'removeprefix',
'removesuffix',
'replace',
'rfind',
'rindex',
'rjust',
'rpartition',
'rsplit',
'rstrip',
'split',
'splitlines',
'startswith',
'strip',
'swapcase',
'title',
'translate',
'upper',
'zfill']
>>> dir(it)
2: ['__class__',
'__delattr__',
'__dir__',
'__doc__',
'__eq__',
'__format__',
'__ge__',
'__getattribute__',
'__getstate__',
'__gt__',
'__hash__',
'__init__',
'__init_subclass__',
'__iter__',
'__le__',
'__length_hint__',
'__lt__',
'__ne__',
'__new__',
'__next__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__setattr__',
'__setstate__',
'__sizeof__',
'__str__',
'__subclasshook__']
>>> next('abeceda')
Traceback (most recent call last):
File "<pyshell#5>", line 1, in <module>
next('abeceda')
TypeError: 'str' object is not an iterator
>>> next(it)
3: 'a'
>>> next(it)
4: 'b'
>>> next(it)
5: 'e'
>>> next(it)
6: 'c'
>>> next(it)
7: 'e'
>>> next(it)
8: 'd'
>>> next(it)
9: 'a'
>>> next(it)
Traceback (most recent call last):
File "<pyshell#13>", line 1, in <module>
next(it)
StopIteration
>>> it = iter('abeceda')
>>> next(it)
10: 'a'
>>> next(it)
11: 'b'
>>> next(it)
12: 'e'
>>> for x in it:
... print(x)
c
e
d
a
>>> def fn():
... yield 1
... yield 2
... yield 3
>>> fn
13: <function fn at 0x000001CD4AF051C0>
>>> fn()
14: <generator object fn at 0x000001CD4ADB73D0>
>>> gen = fn()
>>> dir(fn)
15: ['__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__']
>>> dir(gen)
16: ['__class__',
'__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_suspended',
'gi_yieldfrom',
'send',
'throw']
>>> next(gen)
17: 1
>>> next(gen)
18: 2
>>> next(gen)
19: 3
>>> next(gen)
Traceback (most recent call last):
File "<pyshell#28>", line 1, in <module>
next(gen)
StopIteration
>>> def fn():
... yield 1
... yield 2
... return 'Baf!'
... yield 3
>>> gen = fn()
>>> next(gen)
20: 1
>>> next(gen)
21: 2
>>> next(gen)
Traceback (most recent call last):
File "<pyshell#33>", line 1, in <module>
next(gen)
StopIteration: Baf!
>>> bin(16)
22: '0b10000'
>>> bin(99)
23: '0b1100011'
>>> import re
>>> dir(re)
24: ['A',
'ASCII',
'DEBUG',
'DOTALL',
'I',
'IGNORECASE',
'L',
'LOCALE',
'M',
'MULTILINE',
'Match',
'NOFLAG',
'Pattern',
'RegexFlag',
'S',
'Scanner',
'T',
'TEMPLATE',
'U',
'UNICODE',
'VERBOSE',
'X',
'_MAXCACHE',
'_MAXCACHE2',
'__all__',
'__builtins__',
'__cached__',
'__doc__',
'__file__',
'__loader__',
'__name__',
'__package__',
'__path__',
'__spec__',
'__version__',
'_cache',
'_cache2',
'_casefix',
'_compile',
'_compile_template',
'_compiler',
'_constants',
'_parser',
'_pickle',
'_special_chars_map',
'_sre',
'compile',
'copyreg',
'enum',
'error',
'escape',
'findall',
'finditer',
'fullmatch',
'functools',
'match',
'purge',
'search',
'split',
'sub',
'subn',
'template']
>>>