Python 3.14.3 (tags/v3.14.3:323c59a, Feb 3 2026, 16:04:56) [MSC v.1944 64 bit (AMD64)] on win32 Type "copyright", "credits" or "license()" for more information. DreamPie 1.2.1 >>> def fn(): ... print('Ahoj!') >>> fn 0: <function fn at 0x0000020CB206B690> >>> type(fn) 1: <class 'function'> >>> dir(fn) 2: ['__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] >>> fn.a = 666 >>> dir(fn) 3: ['__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__', 'a'] [About 39 more lines. Double-click to unfold] >>> fn.a 4: 666 >>> fn() Ahoj! >>> print( fn() ) Ahoj! None >>> def fn(a, b): ... print(f'fn: {a} | {b}') >>> fn() Traceback (most recent call last): File "<pyshell#10>", line 1, in <module> fn() ~~^^ TypeError: fn() missing 2 required positional arguments: 'a' and 'b' >>> fn(1) Traceback (most recent call last): File "<pyshell#11>", line 1, in <module> fn(1) ~~^^^ TypeError: fn() missing 1 required positional argument: 'b' >>> fn(1, 2) fn: 1 | 2 >>> fn(a=1, b=2) fn: 1 | 2 >>> fn(b=1, a=2) fn: 2 | 1 >>> fn(1, a=2) Traceback (most recent call last): File "<pyshell#15>", line 1, in <module> fn(1, a=2) ~~^^^^^^^^ TypeError: fn() got multiple values for argument 'a' >>> fn(1, b=2) fn: 1 | 2 >>> def fn(a, b, c): ... print(f'fn: {a} | {b} | {c}') >>> fn(1, 2, 3) fn: 1 | 2 | 3 >>> fn(a=1, b=2, c=3) fn: 1 | 2 | 3 >>> def fn(a, b, /, c): ... print(f'fn: {a} | {b} | {c}') >>> fn(1, 2, 3) fn: 1 | 2 | 3 >>> fn(a=1, b=2, c=3) Traceback (most recent call last): File "<pyshell#22>", line 1, in <module> fn(a=1, b=2, c=3) ~~^^^^^^^^^^^^^^^ TypeError: fn() got some positional-only arguments passed as keyword arguments: 'a, b' >>> fn(1, 2, c=3) fn: 1 | 2 | 3 >>> fn(2, 1, c=3) fn: 2 | 1 | 3 >>> def fn(a=1, b=2, c=3): ... print(f'fn: {a} | {b} | {c}') >>> fn() fn: 1 | 2 | 3 >>> fn(b='baf') fn: 1 | baf | 3 >>> fn(b='baf', c=666, a=1) fn: 1 | baf | 666 >>> def fn(a=1, b=2, *, c=3): ... print(f'fn: {a} | {b} | {c}') >>> fn(1, 2, 3) Traceback (most recent call last): File "<pyshell#30>", line 1, in <module> fn(1, 2, 3) ~~^^^^^^^^^ TypeError: fn() takes from 0 to 2 positional arguments but 3 were given >>> fn(1, 2, c=3) fn: 1 | 2 | 3 >>> fn(c=666) fn: 1 | 2 | 666 >>> fn(666) fn: 666 | 2 | 3 >>> fn(666, 'baf') fn: 666 | baf | 3 >>> fn(666, 'baf', c=123) fn: 666 | baf | 123 >>> def fn(A, B, /, C, a=1, b=2, *, c=3): ... print(f'fn: {A} | {B} | {C}') ... print(f'fn: {a} | {b} | {c}') >>> fn() Traceback (most recent call last): File "<pyshell#37>", line 1, in <module> fn() ~~^^ TypeError: fn() missing 3 required positional arguments: 'A', 'B', and 'C' >>> fn(1, 2, 3) fn: 1 | 2 | 3 fn: 1 | 2 | 3 >>> fn(11, 22, 33) fn: 11 | 22 | 33 fn: 1 | 2 | 3 >>> def fn(xs): ... print(len(xs)) >>> fn('abc') 3 >>> fn([1, 2, 3, 4]) 4 >>> fn.__annotations__ 5: {} >>> def fn(xs: list) -> int: ... print(len(xs)) >>> fn.__annotations__ 6: {'return': <class 'int'>, 'xs': <class 'list'>} >>> fn([1, 2, 3, 4]) 4 >>> fn('abc') 3 >>> def fn(xs: 'Baf!') -> 333: ... print(len(xs)) >>> fn('abc') 3 >>> fn([1, 2, 3, 4]) 4 >>> fn.__annotations__ 7: {'return': 333, 'xs': 'Baf!'} >>> def fn(x, xs=[]): ... xs.append(x) ... return xs >>> fn(1) 8: [1] >>> fn(2) 9: [1, 2] >>> fn(2) 10: [1, 2, 2] >>> fn(2, []) 11: [2] >>> fn(1) 12: [1, 2, 2, 1] >>> x = 1 ... ... def f1(): ... print('2a:', x) ... x = 2 ... print('2b:', x) ... def f2(): ... print('3:', x) ... f2() >>> x 13: 1 >>> f1 14: <function f1 at 0x0000020CB4372F00> >>> f1() Traceback (most recent call last): File "<pyshell#61>", line 1, in <module> f1() ~~^^ File "<pyshell#58>", line 4, in f1 print('2a:', x) ^ UnboundLocalError: cannot access local variable 'x' where it is not associated with a value >>> def f1(): ... x += 2 ... print('2:', x) >>> f1() Traceback (most recent call last): File "<pyshell#63>", line 1, in <module> f1() ~~^^ File "<pyshell#62>", line 2, in f1 x += 2 ^ UnboundLocalError: cannot access local variable 'x' where it is not associated with a value >>> x 15: 1 >>> def f1(): ... x = x + 2 ... print('2:', x) >>> f1() Traceback (most recent call last): File "<pyshell#66>", line 1, in <module> f1() ~~^^ File "<pyshell#65>", line 2, in f1 x = x + 2 ^ UnboundLocalError: cannot access local variable 'x' where it is not associated with a value >>> def fn(x, xs=[]): ... xs.append(x) ... return xs >>> x 16: 1 >>> del x >>> x Traceback (most recent call last): File "<pyshell#70>", line 1, in <module> x NameError: name 'x' is not defined >>> fn(1, []) 17: [1] >>> fn(2, []) 18: [2] >>> fn(3) 19: [3] >>> fn(2, []) 20: [2] >>> fn(1, []) 21: [1] >>> fn('a') 22: [3, 'a'] >>> import sys >>> dir(sys) 23: ['__breakpointhook__', '__displayhook__', '__doc__', '__excepthook__', '__loader__', '__name__', '__package__', '__spec__', '__stderr__', '__stdin__', '__stdout__', '__unraisablehook__', '_base_executable', '_baserepl', '_clear_internal_caches', '_clear_type_cache', '_clear_type_descriptors', '_current_exceptions', '_current_frames', '_debugmallocstats', '_dump_tracelets', '_enablelegacywindowsfsencoding', '_framework', '_get_cpu_count_config', '_getframe', '_getframemodulename', '_git', '_is_gil_enabled', '_is_immortal', '_is_interned', '_jit', '_setprofileallthreads', '_settraceallthreads', '_stdlib_dir', '_vpath', '_xoptions', 'activate_stack_trampoline', 'addaudithook', 'api_version', 'argv', 'audit', 'base_exec_prefix', 'base_prefix', 'breakpointhook', 'builtin_module_names', 'byteorder', 'call_tracing', 'copyright', 'deactivate_stack_trampoline', 'displayhook', 'dllhandle', 'dont_write_bytecode', 'exc_info', 'excepthook', 'exception', 'exec_prefix', 'executable', 'exit', 'flags', 'float_info', 'float_repr_style', 'get_asyncgen_hooks', 'get_coroutine_origin_tracking_depth', 'get_int_max_str_digits', 'getallocatedblocks', 'getdefaultencoding', 'getfilesystemencodeerrors', 'getfilesystemencoding', 'getprofile', 'getrecursionlimit', 'getrefcount', 'getsizeof', 'getswitchinterval', 'gettrace', 'getunicodeinternedsize', 'getwindowsversion', 'hash_info', 'hexversion', 'implementation', 'int_info', 'intern', 'is_finalizing', 'is_remote_debug_enabled', 'is_stack_trampoline_active', 'last_traceback', 'last_type', 'last_value', 'maxsize', 'maxunicode', 'meta_path', 'modules', 'monitoring', 'orig_argv', 'path', 'path_hooks', 'path_importer_cache', 'platform', 'platlibdir', 'prefix', 'pycache_prefix', 'remote_exec', 'set_asyncgen_hooks', 'set_coroutine_origin_tracking_depth', 'set_int_max_str_digits', 'setprofile', 'setrecursionlimit', 'setswitchinterval', 'settrace', 'stderr', 'stdin', 'stdlib_module_names', 'stdout', 'thread_info', 'unraisablehook', 'version', 'version_info', 'warnoptions', 'winver'] [About 117 more lines. Double-click to unfold] >>> int(0.3) 24: 0 >>> int(0.7) 25: 0 >>> map(float, ['0.23', '1.17', '0']) 26: <map object at 0x0000020CB43158C0> >>> for i in map(float, ['0.23', '1.17', '0']): ... print(i) 0.23 1.17 0.0 >>> for i in map(float, ['0.23', '1.17', '0']): ... print(i, type(i)) 0.23 <class 'float'> 1.17 <class 'float'> 0.0 <class 'float'> >>> list( map(float, ['0.23', '1.17', '0']) ) 27: [0.23, 1.17, 0.0] >>> def fn(*s): ... print(f's = {s}') >>> fn 28: <function fn at 0x0000020CB439B320> >>> fn() s = () >>> fn(1) s = (1,) >>> fn(1, 2) s = (1, 2) >>> fn(1, 2, 3) s = (1, 2, 3) >>> def fn(*s, **ds): ... print(f's = {s}') ... print(f'ds = {ds}') >>> fn() s = () ds = {} >>> fn(1, 2) s = (1, 2) ds = {} >>> fn(1, 2, a=3, b='abc') s = (1, 2) ds = {'a': 3, 'b': 'abc'} >>> def fn(*args, **kwargs): ... print(f'{args}') ... print(f'{kwargs}') >>> fn(1, 2, a=3, b='abc') (1, 2) {'a': 3, 'b': 'abc'} >>> def fn(a, b, c): ... print(a, b, c) >>> fn() Traceback (most recent call last): File "<pyshell#98>", line 1, in <module> fn() ~~^^ TypeError: fn() missing 3 required positional arguments: 'a', 'b', and 'c' >>> fn(1, 2, 3) 1 2 3 >>> xs = 'a', 'b', 'c' >>> type(xs) 29: <class 'tuple'> >>> xs 30: ('a', 'b', 'c') >>> fn(xs) Traceback (most recent call last): File "<pyshell#103>", line 1, in <module> fn(xs) ~~^^^^ TypeError: fn() missing 2 required positional arguments: 'b' and 'c' >>> fn(*xs) a b c >>> ds = { ... 'a': 1, ... 'b': 2, ... 'c': 3, ... } >>> ds 31: {'a': 1, 'b': 2, 'c': 3} >>> def fn(a, b, c): ... print(a, b, c) >>> fn(ds) Traceback (most recent call last): File "<pyshell#108>", line 1, in <module> fn(ds) ~~^^^^ TypeError: fn() missing 2 required positional arguments: 'b' and 'c' >>> fn(*ds) a b c >>> fn(**ds) 1 2 3 >>> def fn(a=11, b=22, c=33): ... print(a, b, c) >>> fn() 11 22 33 >>> fn(*ds) a b c >>> fn(**ds) 1 2 3 >>> ds 32: {'a': 1, 'b': 2, 'c': 3} >>> ds = { ... 'A': 1, ... 'B': 2, ... 'C': 3, ... } >>> fn(*ds) A B C >>> fn(**ds) Traceback (most recent call last): File "<pyshell#118>", line 1, in <module> fn(**ds) ~~^^^^^^ TypeError: fn() got an unexpected keyword argument 'A'. Did you mean 'a'? >>> import typing >>> dir(typing) 33: ['ABCMeta', 'AbstractSet', 'Annotated', 'Any', 'AnyStr', 'AsyncGenerator', 'AsyncIterable', 'AsyncIterator', 'Awaitable', 'BinaryIO', 'ByteString', 'CT_co', 'Callable', 'ChainMap', 'ClassVar', 'Collection', 'Concatenate', 'Container', 'Coroutine', 'Counter', 'DefaultDict', 'Deque', 'Dict', 'EXCLUDED_ATTRIBUTES', 'Final', 'FrozenSet', 'Generator', 'Generic', 'GenericAlias', 'Hashable', 'IO', 'ItemsView', 'Iterable', 'Iterator', 'KT', 'KeysView', 'List', 'Literal', 'LiteralString', 'Mapping', 'MappingView', 'MutableMapping', 'MutableSequence', 'MutableSet', 'NamedTuple', 'NamedTupleMeta', 'Never', 'NewType', 'NoDefault', 'NoReturn', 'NotRequired', 'Optional', 'OrderedDict', 'ParamSpec', 'ParamSpecArgs', 'ParamSpecKwargs', 'Protocol', 'ReadOnly', 'Required', 'Reversible', 'Self', 'Sequence', 'Set', 'Sized', 'SupportsAbs', 'SupportsBytes', 'SupportsComplex', 'SupportsFloat', 'SupportsIndex', 'SupportsInt', 'SupportsRound', 'T', 'TYPE_CHECKING', 'T_co', 'T_contra', 'Text', 'TextIO', 'Tuple', 'Type', 'TypeAlias', 'TypeAliasType', 'TypeGuard', 'TypeIs', 'TypeVar', 'TypeVarTuple', 'TypedDict', 'Union', 'Unpack', 'VT', 'VT_co', 'V_co', 'ValuesView', '_ASSERT_NEVER_REPR_MAX_LENGTH', '_AnnotatedAlias', '_AnyMeta', '_BaseGenericAlias', '_CallableGenericAlias', '_CallableType', '_ConcatenateGenericAlias', '_DeprecatedGenericAlias', '_Final', '_Func', '_GenericAlias', '_IdentityCallable', '_LazyAnnotationLib', '_LiteralGenericAlias', '_NamedTuple', '_NotIterable', '_PROTO_ALLOWLIST', '_ProtocolMeta', '_SPECIAL_NAMES', '_Sentinel', '_SpecialForm', '_SpecialGenericAlias', '_TYPING_INTERNALS', '_TupleType', '_TypedCacheSpecialForm', '_TypedDict', '_TypedDictMeta', '_TypingEllipsis', '_UnionGenericAlias', '_UnionGenericAliasMeta', '_UnpackGenericAlias', '__all__', '__builtins__', '__cached__', '__doc__', '__file__', '__getattr__', '__loader__', '__name__', '__package__', '__spec__', '_abc_instancecheck', '_abc_subclasscheck', '_add_type_params_to_scope', '_alias', '_allow_reckless_class_checks', '_caches', '_caller', '_check_generic_specialization', '_cleanups', '_collect_type_parameters', '_deduplicate', '_deprecation_warning_for_no_type_params_passed', '_eval_type', '_flatten_literal_params', '_generic_class_getitem', '_generic_init_subclass', '_get_protocol_attrs', '_get_typeddict_qualifiers', '_idfunc', '_is_dunder', '_is_param_expr', '_is_typevar_like', '_is_unpacked_typevartuple', '_lazy_annotationlib', '_lazy_load_getattr_static', '_make_eager_annotate', '_make_forward_ref', '_make_nmtuple', '_namedtuple_mro_entries', '_no_init_or_replace_init', '_overload_dummy', '_overload_registry', '_paramspec_prepare_subst', '_paramspec_subst', '_prohibited', '_proto_hook', '_sentinel', '_should_unflatten_callable_args', '_special', '_strip_annotations', '_tp_cache', '_type_check', '_type_check_issubclass_arg_1', '_type_convert', '_type_repr', '_typevar_subst', '_typevartuple_prepare_subst', '_unpack_args', '_value_and_type_iter', 'abstractmethod', 'assert_never', 'assert_type', 'cast', 'clear_overloads', 'collections', 'copyreg', 'dataclass_transform', 'defaultdict', 'evaluate_forward_ref', 'final', 'functools', 'get_args', 'get_origin', 'get_overloads', 'get_protocol_members', 'get_type_hints', 'is_protocol', 'is_typeddict', 'no_type_check', 'no_type_check_decorator', 'operator', 'overload', 'override', 'reveal_type', 'runtime_checkable', 'sys', 'types'] [About 209 more lines. Double-click to unfold] >>> from functools import partial >>> print(1, 2, 3) 1 2 3 >>> pprint = partial(print, sep='|') >>> pprint(1, 2, 3) 1|2|3 >>> #print = partial(print, sep='|') >>> #open = partial(open, encoding='utf-8') >>> import operator >>> dir(operator) 34: ['__abs__', '__add__', '__all__', '__and__', '__builtins__', '__cached__', '__call__', '__concat__', '__contains__', '__delitem__', '__doc__', '__eq__', '__file__', '__floordiv__', '__ge__', '__getitem__', '__gt__', '__iadd__', '__iand__', '__iconcat__', '__ifloordiv__', '__ilshift__', '__imatmul__', '__imod__', '__imul__', '__index__', '__inv__', '__invert__', '__ior__', '__ipow__', '__irshift__', '__isub__', '__itruediv__', '__ixor__', '__le__', '__loader__', '__lshift__', '__lt__', '__matmul__', '__mod__', '__mul__', '__name__', '__ne__', '__neg__', '__not__', '__or__', '__package__', '__pos__', '__pow__', '__rshift__', '__setitem__', '__spec__', '__sub__', '__truediv__', '__xor__', '_abs', 'abs', 'add', 'and_', 'attrgetter', 'call', 'concat', 'contains', 'countOf', 'delitem', 'eq', 'floordiv', 'ge', 'getitem', 'gt', 'iadd', 'iand', 'iconcat', 'ifloordiv', 'ilshift', 'imatmul', 'imod', 'imul', 'index', 'indexOf', 'inv', 'invert', 'ior', 'ipow', 'irshift', 'is_', 'is_none', 'is_not', 'is_not_none', 'isub', 'itemgetter', 'itruediv', 'ixor', 'le', 'length_hint', 'lshift', 'lt', 'matmul', 'methodcaller', 'mod', 'mul', 'ne', 'neg', 'not_', 'or_', 'pos', 'pow', 'rshift', 'setitem', 'sub', 'truediv', 'truth', 'xor'] [About 112 more lines. Double-click to unfold] >>> reduce(lambda x, y: x + y, [5, 2, 4, 3, 6]) Traceback (most recent call last): File "<pyshell#129>", line 1, in <module> reduce(lambda x, y: x + y, [5, 2, 4, 3, 6]) ^^^^^^ NameError: name 'reduce' is not defined >>> from functools import reduce >>> reduce(lambda x, y: x + y, [5, 2, 4, 3, 6]) 35: 20 >>> reduce(operator.add, [5, 2, 4, 3, 6]) 36: 20 >>> import string >>> dir(string) 37: ['Formatter', 'Template', '_TemplatePattern', '__all__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '_sentinel_dict', '_string', 'ascii_letters', 'ascii_lowercase', 'ascii_uppercase', 'capwords', 'digits', 'hexdigits', 'octdigits', 'printable', 'punctuation', 'whitespace'] >>> string.whitespace 38: ' \t\n\r\x0b\x0c' >>> string.printable 39: ('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ \t\n' '\r' '\x0b' '\x0c') >>> string.ascii_lowercase 40: 'abcdefghijklmnopqrstuvwxyz' >>>