New statement proposal for Python

Andreas Jung andreas at andreas-jung.com
Thu Jun 14 14:06:03 EDT 2001


"David LeBlanc" <whisper at oz.nospamnet> schrieb im Newsbeitrag
news:9gao5s$8ft$7 at 216.39.170.247...
> One thing that bugs me about Python is that there's no really good way to
> have named constants so that magic numbers can be avoided. Assigning to a
> variable that (should) never changes is not the same (i.e. the "should
> never" part).
>
> My proposal:
>
> alias httpport : 80
> alias astring : "Strings are ok too!"
> alias alist : [a, b, c]
> alias atuple : {one : 1} #etc.
> alias aconstant : can be anything not containing an explict nl or #
> alias true: 1 # create an alias for 1
>
> alias true: not 0 # this is ok too, but not after the previous
> # declaration!
> >> error: redefinion error!
>
> alias false: is zero # everything up to the nl or octothorpe is the
>    # replacement text
>


Extremly ugly and I don't know what the real benefits are...
syntactic sugar.

Andreas






More information about the Python-list mailing list