What’s up Python ? Rust in CPython, immutable dicts, unpacking in comprehensions...
bitecode.dev·5w
🦀Rust Macros
Preview
Report Post

For the 3rd time, a proposal for adding an immutable mapping type to Python has landed.

We will be allowed to use unpacking in comprehensions in Python 3.15.

The debate of whether to introduce Rust to CPython has started, and it’s intense.

And moar stuff.

Python’s distinction between mutable (can be modified after creation) and immutable (can’t be modified after creation) lives on the objects themselves, not the variable, like, say, in Rust with the mut keyword.

Strings and tuples are immutable. But byte arrays and lists are mutable.

Sets even have a frozenset counterpart:

>>> s = {1, 2, 3}
>>> s.add(4)
>>> s
{1, 2, 3, 4}
>>> s2 = frozenset(s)
>>> s2
frozenset({1, 2, 3})
>>> s2.add(4)
Traceback (most recent call last):
File “<python-input-4>”, l...

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help