Python 3.13.3 (tags/v3.13.3:6280bb5, Apr 8 2025, 14:47:33) [MSC v.1943 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
DreamPie 1.2.1
>>> xs = {
... 1: 'Ahoj!',
... 'Baf!': 333,
... (3, 'a'): print,
... }
>>> xs
0: {1: 'Ahoj!', 'Baf!': 333, (3, 'a'): <built-in function print>}
>>> xs['Baf!']
1: 333
>>> xs[1]
2: 'Ahoj!'
>>> xs[(3, 'a')]
3: <built-in function print>
>>> xs[3, 'a']
4: <built-in function print>
>>> dir(xs)
5: ['__class__',
'__class_getitem__',
'__contains__',
'__delattr__',
'__delitem__',
'__dir__',
'__doc__',
'__eq__',
'__format__',
'__ge__',
'__getattribute__',
'__getitem__',
'__getstate__',
'__gt__',
'__hash__',
'__init__',
'__init_subclass__',
'__ior__',
'__iter__',
'__le__',
'__len__',
'__lt__',
'__ne__',
'__new__',
'__or__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__reversed__',
'__ror__',
'__setattr__',
'__setitem__',
'__sizeof__',
'__str__',
'__subclasshook__',
'clear',
'copy',
'fromkeys',
'get',
'items',
'keys',
'pop',
'popitem',
'setdefault',
'update',
'values']
[About 45 more lines. Double-click to unfold]
>>> for x in xs:
... print(x)
1
Baf!
(3, 'a')
>>> xs
6: {1: 'Ahoj!', 'Baf!': 333, (3, 'a'): <built-in function print>}
>>> for x in xs.keys():
... print(x)
1
Baf!
(3, 'a')
>>> for x in xs.values():
... print(x)
Ahoj!
333
<built-in function print>
>>> for x in xs.items():
... print(x)
(1, 'Ahoj!')
('Baf!', 333)
((3, 'a'), <built-in function print>)
>>> for k,v in xs.items():
... print(f'{k} --> {v}')
1 --> Ahoj!
Baf! --> 333
(3, 'a') --> <built-in function print>
>>> xs[1]
7: 'Ahoj!'
>>> xs[1] = 'basta'
>>> xs[1]
8: 'basta'
>>> xs
9: {1: 'basta', 'Baf!': 333, (3, 'a'): <built-in function print>}
>>> xs['ABC'] = 666, 333
>>> xs
10: {1: 'basta',
'ABC': (666, 333),
'Baf!': 333,
(3, 'a'): <built-in function print>}
>>> del xs[1]
>>> xs
11: {'ABC': (666, 333), 'Baf!': 333, (3, 'a'): <built-in function print>}
>>> xs[1]
Traceback (most recent call last):
File "<pyshell#21>", line 1, in <module>
xs[1]
~~^^^
KeyError: 1
>>> xs.get(1)
>>> xs.get('ABC')
12: (666, 333)
>>> print(xs.get(1))
None
>>> xs.get('ABC', 999)
13: (666, 333)
>>> xs.get(1, 999)
14: 999
>>> list('abc')
15: ['a', 'b', 'c']
>>> dict('abc')
Traceback (most recent call last):
File "<pyshell#28>", line 1, in <module>
dict('abc')
~~~~^^^^^^^
ValueError: dictionary update sequence element #0 has length 1; 2 is required
>>> dict(('abc', 1), (2, 'def'))
Traceback (most recent call last):
File "<pyshell#29>", line 1, in <module>
dict(('abc', 1), (2, 'def'))
~~~~^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: dict expected at most 1 argument, got 2
>>> dict([('abc', 1), (2, 'def')])
16: {2: 'def', 'abc': 1}
>>> set('abc')
17: {'c', 'b', 'a'}
>>> set('abeceda')
18: {'e', 'b', 'd', 'a', 'c'}
>>> set({2: 'def', 'abc': 1})
19: {'abc', 2}
>>> dir({})
20: ['__class__',
'__class_getitem__',
'__contains__',
'__delattr__',
'__delitem__',
'__dir__',
'__doc__',
'__eq__',
'__format__',
'__ge__',
'__getattribute__',
'__getitem__',
'__getstate__',
'__gt__',
'__hash__',
'__init__',
'__init_subclass__',
'__ior__',
'__iter__',
'__le__',
'__len__',
'__lt__',
'__ne__',
'__new__',
'__or__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__reversed__',
'__ror__',
'__setattr__',
'__setitem__',
'__sizeof__',
'__str__',
'__subclasshook__',
'clear',
'copy',
'fromkeys',
'get',
'items',
'keys',
'pop',
'popitem',
'setdefault',
'update',
'values']
[About 45 more lines. Double-click to unfold]
>>> dir(set())
21: ['__and__',
'__class__',
'__class_getitem__',
'__contains__',
'__delattr__',
'__dir__',
'__doc__',
'__eq__',
'__format__',
'__ge__',
'__getattribute__',
'__getstate__',
'__gt__',
'__hash__',
'__iand__',
'__init__',
'__init_subclass__',
'__ior__',
'__isub__',
'__iter__',
'__ixor__',
'__le__',
'__len__',
'__lt__',
'__ne__',
'__new__',
'__or__',
'__rand__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__ror__',
'__rsub__',
'__rxor__',
'__setattr__',
'__sizeof__',
'__str__',
'__sub__',
'__subclasshook__',
'__xor__',
'add',
'clear',
'copy',
'difference',
'difference_update',
'discard',
'intersection',
'intersection_update',
'isdisjoint',
'issubset',
'issuperset',
'pop',
'remove',
'symmetric_difference',
'symmetric_difference_update',
'union',
'update']
[About 56 more lines. Double-click to unfold]
>>>