Hi,

We have function and class decorators. Can we also have decorators for
variable assignments?

For example:
  @validate_proxy
  proxy = "http://user:[EMAIL PROTECTED]:port/"

be a syntactical sugar for:
  proxy = validate_proxy("http://user:[EMAIL PROTECTED]:port/")


Python is often used as a configuration language (small utility
scripts, Django, etc.) and it makes more sense to have the validation
of a user supplied configuration value at the time of assignment
rather than leaving the burden of validation on every piece of code
that uses it. Although both approaches can be used for it, a user will
be more hesitant to edit the string in the latter form (the former one
is also more readable IMHO).


Arvind

PS: I hope it's not something too radical to talk so late about.
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to