remaining decorator syntax options
peter at engcorp.com
Tue Aug 10 23:23:53 CEST 2004
Grzegorz Dostatni wrote:
> At the end of the day, I would look for precedents:
> Python: c/c++ Ruby
> and & and
> or | or
> self.foo @foo
> global $foo
> I am aware of the symbols python uses (#, %, **, &, |). With the
> exception of #, I generally find a way to avoid them.
Corrections to the above:
C/C++ use && and || for "and" and "or". The single-char versions are
operators used in mathematical expressions, and used identically
in Python (and Ruby? or does it use words for both?).
As for the "symbols" of Python: % ** & and | are all math
operators, so they don't really apply here in the same way
as other things do. Avoiding them would be senseless, given
that when you need them, you need them, in the same way you
wouldn't go around trying to avoid + or / either.
# to introduce a comment is clearly in line with other languages
that use symbols instead of words ("rem" from BASIC? Ugh...) but
it is also a _very_ widely used convention at this point, and
comes directly from Python's ancestry in system admin stuff.
In the end, though, a new keyword would pretty much rock for this
whole mess, especially if it were to immediate follow the function
def's colon, and have it's own colon with an indented block following.
More information about the Python-list