Hacker News new | past | comments | ask | show | jobs | submit login

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.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: