Live data from Hacker News

Python proposal: add immutable (persistent) dictionaries

python.org

1–7 of 7 posts

Re: Python proposal: add immutable (persistent) dictionaries

#3
This is the kind of ad-hoc PEP proposal that could be completely avoidable if there was a generic modifier or initialization/declaration construction for declaring a variable as constant. So incredibly simple, so incredibly useful that it's hard to believe that it hasn't been accepted yet (it was proposed).

Re: Python proposal: add immutable (persistent) dictionaries

#4
post #3

This is the kind of ad-hoc PEP proposal that could be completely avoidable if there was a generic modifier or initialization/declaration construction for declaring a variable as constant. So incredibly simple, so incredibly useful that it's hard to believe that it hasn't been accepted yet (it was proposed).

A const declaration only ensures that the variable always points to the same object, not that that object is immutable. For instance in JS:

const foo = {};

foo.bar = 1;

Re: Python proposal: add immutable (persistent) dictionaries

#7
post #3

This is the kind of ad-hoc PEP proposal that could be completely avoidable if there was a generic modifier or initialization/declaration construction for declaring a variable as constant. So incredibly simple, so incredibly useful that it's hard to believe that it hasn't been accepted yet (it was proposed).

A const declaration only ensures that the variable always points to the same object, not that that object is immutable. For instance in JS: const foo = {}; foo.bar = 1;

That depends on the language.