News for hackers. Stuff that matters.
Re:Joe Stump: Why I switched from PHP to Python by njharman on Saturday September 05, 2009 @08:50PM (#807306)
Only decorator syntax happens somewhere around parse-time (which I call import time, but meh).

> completely mask the def that they are applied to.

@decorator reassign to the name of the def. But if there are other refs to that def they do not change and are not "masked". It is no different than assignment. You know that these two are identical, right?

  @foo
  def bar():
    pass
  
  def bar():
    pass
  bar = foo(bar)
Also this is a perfectly valid decorater that doesn't mask the original func

  def deco(func):
    # do something terrible clever here
    return func

decorator syntax != decorators is my main point. But by conflating the two I can begin to understand your statement.

There are no comments on this comment yet.