pxeger / whython

Fork of Python with some terrible custom features hacked in
https://www.pxeger.com/2021-09-19-hacking-on-cpython/
Other
16 stars 3 forks source link

Allow assigning to constants #2

Open cgccuser opened 2 years ago

cgccuser commented 2 years ago

Why should 1 always be 1? Why can True never be False? Why can None never be "everything"? These arbitrary, fascist rules must not be enforced any longer. The Python developers may never listen to me, but I hope that the open-minded folks at Whython will. I propose allowing users to assign values to constants/literals/whatever they're called. No longer should "bad" = "good" be an error! It should replace all occurrences of the string bad with good later in the program. Likewise for numbers and stuff.

pxeger commented 2 years ago

Not sure this is really possible...

cgccuser commented 2 years ago

Perhaps you could replace every constant/literal with get_literal_or_previously_assigned_value("foo") and have a dictionary of these previously assigned "constants."

pxeger commented 2 years ago

Ooh, that's an excellent hack!