New statement proposal for Python

John Roth johnroth at ameritech.net
Fri Jun 15 16:24:17 CEST 2001


"Nick Perkins" <nperkins7 at home.com> wrote in message
news:nQeW6.237411$eK2.50576177 at news4.rdc1.on.home.com...
>
> "David LeBlanc" <whisper at oz.nospamnet> wrote in message
> news:9gbsdv$8ft$9 at 216.39.170.247...
>
> > alias true: 1
> ...
> >...read so nicely to be able to say "if something is true"
>
> it's even easier than that:
>
> if something:
>     ...
>
> ..which can 'read' just as well, if you choose your names accordingly.
>
> ..but on a more general note, am i to understand that you are suggesting
> C-style macros, where code is 'physically substituted', before being run?
> That would be a Bad Thing, i think.   C was a nice little language before
it
> turned into a giant mess of macro substitutions.

I didn't understand David's proposal as macro preprocessing. I understood it
as a request for a one-time assignment (i.e., one that guaranteed that the
name
couldn't be reassigned (or rebound to a different object, for language
purists)).

As far as I'm concerned, that's the essence of the proposal: whatever object
is
bound to the name will not change (at least, until the code is edited!) This
means
that it really only makes sense for immutable objects.

I also don't really care about the syntax - there are people working on
Python
who are much more knowledagable about what would fit cleanly. I prefer
"const",
but I could live quite happily with "alias." Likewise, I prefer "=", since
my
vision is that it really is a (one-time) assignment, but I could live with
":".

The run-time issue (how to make it happen) could be fairly messy - I don't
know
of any mechanism currently in Python that will prevent a name from being
rebound
to another object.

The problems with the C language #define statement are outside of the
scope of this discussion, other than as a horrible example of how to add a
layer
of obfustication to a program.

John Roth
>
>
>
>





More information about the Python-list mailing list