Introduce constants in Python (constant name binding)
25 May
2021
25 May
'21
11:53 a.m.
I posted my previous idea regarding this on the mailing list. This idea is a little different. This idea suggests introducing constant name bindings. This is similar to const pointer in C/C++. Once a name has been assigned to a data we can change the data (if mutable) but we cannot change the name to point to a different data. The only way the data the constant points can get deallocated is if it goes out of scope, the program exits or the constant is manually `del` by the user. The proposed syntax is as follows, constant x = 10 constant y = ["List"] constant z: str = "Hi" Thanking you, With Regards
1025
Age (days ago)
1029
Last active (days ago)
68 comments
17 participants
participants (17)
-
2QdxY4RzWzUUiLuE@potatochowder.com
-
Abdur-Rahmaan Janhangeer
-
Chris Angelico
-
Christopher Barker
-
Damian Shaw
-
David Mertz
-
Ethan Furman
-
MRAB
-
Paul Moore
-
Paul Sokolovsky
-
Richard Damon
-
Rob Cliffe
-
Shreyan Avigyan
-
Shreyan Avigyan
-
Stephen J. Turnbull
-
Stestagg
-
Steven D'Aprano