@@ -260,7 +260,7 @@ kw"'"
260
260
"""
261
261
const
262
262
263
- `const` is used to declare global variables which are also constant . In almost all code
263
+ `const` is used to declare global variables whose values will not change . In almost all code
264
264
(and particularly performance sensitive code) global variables should be declared
265
265
constant in this way.
266
266
@@ -275,15 +275,17 @@ const y, z = 7, 11
275
275
276
276
Note that `const` only applies to one `=` operation, therefore `const x = y = 1`
277
277
declares `x` to be constant but not `y`. On the other hand, `const x = const y = 1`
278
- declares both `x` and `y` as constants .
278
+ declares both `x` and `y` constant .
279
279
280
- Note that "constant-ness" is not enforced inside containers, so if `x` is an array or
281
- dictionary (for example) you can still add and remove elements.
280
+ Note that "constant-ness" does not extend into mutable containers; only the
281
+ association between a variable and its value is constant.
282
+ If `x` is an array or dictionary (for example) you can still modify, add, or remove elements.
282
283
283
- Technically, you can even redefine `const` variables, although this will generate a
284
- warning from the compiler. The only strict requirement is that the *type* of the
285
- variable does not change, which is why `const` variables are much faster than regular
286
- globals.
284
+ In some cases changing the value of a `const` variable gives a warning instead of
285
+ an error.
286
+ However, this can produce unpredictable behavior or corrupt the state of your program,
287
+ and so should be avoided.
288
+ This feature is intended only for convenience during interactive use.
287
289
"""
288
290
kw " const"
289
291
0 commit comments