News for hackers. Stuff that matters.
Re:Why Python? by cabalamat on Saturday October 23, 2010 @04:28AM (#1823000)
or, more usually one of these:

    def somefunc(x, y):
        blabla
    dec(somefunc)

    def somefunc(x, y):
        blabla
    somefunc = dec(somefunc)
The rationale for decorators, AIUI, is that if somefunc() is long, then putting the decorator at the end makes it easier to overlook, whereas putting it at the top is harder to overlook. Personally, I never use them; if I want the functionality of decorators, I write code immediately after the function, e.g.:

   def add(a, b):
      r = a.getValue() + b.getValue()
      return sm.UInteger(r)
   notify(add, "ii", "i", "+", cascade=True)
BTW, lists, tuples and dicts have been in Python since forever (at least as far back as 0.9.1)

There are no comments on this comment yet.