zero new keyword decorator

Roman Suzi rnd at onego.ru
Thu Aug 12 14:08:32 EDT 2004


After a week of reading decorator discussion my mind slowly
turnes in the opposite direction: to find which syntaxes are absolutely
unwanted.

It seems that people like @ more than lambda, so this will never be in Python:

def fun:
   dec1; dec2; dec3
lambda x, y:
   """ docs """
   body


Also our decorator discussion reminds me of Forth

BUILD>

DOES>

words. That is, decorators and arglist are after-build and
"does" part - after the ":".

Why not?


build fun(arg1, arg2):
  decor1; decor2
  decor3
def:
  body
else:
  (if everything went right)

Or, if we want to catch errors in decorators, a special version:


try def fun(arg1, arg2):
  decor1; decor2
  decor3
def:
  body
except:
  (if everything went wrong)
finally:
  (anyway do this)


Or, if we want to say function is needed for decorators and not the other
way around:

for:
  decor1
  decor2
def fun(x, y):
  body


What about

exec:
  decor1
  decor2
def fun(x, y):
  body


Maybe this way we could get rid of '@':

decor1, decor2(a), decor3 for
def fun(x, y):
  body



Sincerely yours, Roman Suzi
-- 
rnd at onego.ru =\= My AI powered by GNU/Linux RedHat 7.3



More information about the Python-list mailing list