diff --git a/q.py b/q.py
index c81a371..880bdc8 100644
--- a/q.py
+++ b/q.py
@@ -272,8 +272,9 @@ def __call__(self, *args):
lines = info.code_context[:info.index + 1]
# If we see "@q" on a single line, behave like a trace decorator.
- if lines[-1].strip().startswith('@') and args:
- return self.trace(args[0])
+ for line in lines:
+ if line.strip() in ('@q', '@q()') and args:
+ return self.trace(args[0])
# Otherwise, search for the beginning of the call expression; once it
# parses, use the expressions in the call to label the debugging output.