>> In Python, decorators are very
>> powerful for modifying function behavior (i.e., attaching pre/post
>> conditions to functions or doing some things phpunit does is really
>> easy) but it is too much for just attaching data.

FWIW (and I apologize if this is just adding to the noise), one of the most 
powerful things about decorators in Python is that the decorator can do 
different things in different contexts.

For example, in the web-app context `@app.task` might cause a function’s 
execution be deferred, and return quickly so the actual work can be carried out 
by another process.

In a worker context, `@app.task` could be used to define the work that should 
actually be carried out by the current worker.

Reference for those interested in a practical example: 
http://celery.readthedocs.org/en/latest/userguide/tasks.html

S


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to