Re: I love the decorator in Python!!!

2011-12-12 Thread alex23
On Dec 13, 2:27 am, Robert Kern wrote: > On 12/12/11 3:36 AM, alex23 wrote: > > > On Dec 9, 8:08 pm, Robert Kern  wrote: > >> On 12/9/11 5:02 AM, alex23 wrote: > >>> The 3rd party 'decorator' module takes care of issues like docstrings > >>> &    function signatures. I'd really like to see some of

Re: I love the decorator in Python!!!

2011-12-12 Thread Robert Kern
On 12/12/11 3:36 AM, alex23 wrote: On Dec 9, 8:08 pm, Robert Kern wrote: On 12/9/11 5:02 AM, alex23 wrote: The 3rd party 'decorator' module takes care of issues like docstrings &function signatures. I'd really like to see some of that functionality in the stdlib though. Much of it is:

Re: I love the decorator in Python!!!

2011-12-12 Thread 88888 Dihedral
On Monday, December 12, 2011 1:47:52 PM UTC+8, alex23 wrote: > On Dec 12, 2:51 pm, 8 Dihedral > wrote: > > To wrap a function properly is different from the 1-line lampda. > > > > This is really functional programming. > > > > Every function can be decorated to change into a different one easi

Re: I love the decorator in Python!!!

2011-12-12 Thread Ethan Furman
alex23 wrote: On Dec 9, 8:08 pm, Robert Kern wrote: On 12/9/11 5:02 AM, alex23 wrote: The 3rd party 'decorator' module takes care of issues like docstrings & function signatures. I'd really like to see some of that functionality in the stdlib though. Much of it is: http://docs.python.org

Re: I love the decorator in Python!!!

2011-12-11 Thread alex23
On Dec 12, 2:51 pm, 8 Dihedral wrote: > To wrap a function properly is different from the 1-line lampda. > > This is really functional programming. > > Every function can be decorated to change into a different one easily. > > There is  a method to replace every return action  of a python func

Re: I love the decorator in Python!!!

2011-12-11 Thread 88888 Dihedral
On Monday, December 12, 2011 11:36:07 AM UTC+8, alex23 wrote: > On Dec 9, 8:08 pm, Robert Kern wrote: > > On 12/9/11 5:02 AM, alex23 wrote: > > > The 3rd party 'decorator' module takes care of issues like docstrings > > > &  function signatures. I'd really like to see some of that > > > functional

Re: I love the decorator in Python!!!

2011-12-11 Thread alex23
On Dec 9, 8:08 pm, Robert Kern wrote: > On 12/9/11 5:02 AM, alex23 wrote: > > The 3rd party 'decorator' module takes care of issues like docstrings > > &  function signatures. I'd really like to see some of that > > functionality in the stdlib though. > > Much of it is: > >    http://docs.python.o

Re: I love the decorator in Python!!!

2011-12-10 Thread 88888 Dihedral
Wrap functions to yield is somewhat like a sub-threading in Erlang. -- http://mail.python.org/mailman/listinfo/python-list

Re: I love the decorator in Python!!!

2011-12-10 Thread 88888 Dihedral
Just wrap the exec() to spawn for fun. -- http://mail.python.org/mailman/listinfo/python-list

Re: I love the decorator in Python!!!

2011-12-09 Thread 88888 Dihedral
On Saturday, December 10, 2011 2:28:49 AM UTC+8, 8 Dihedral wrote: > On Thursday, December 8, 2011 7:43:12 PM UTC+8, Chris Angelico wrote: > > On Thu, Dec 8, 2011 at 10:22 PM, K.-Michael Aye wrote: > > > I am still perplexed about decorators though, am happily using Python for > > > many years

Re: I love the decorator in Python!!!

2011-12-09 Thread 88888 Dihedral
On Thursday, December 8, 2011 7:43:12 PM UTC+8, Chris Angelico wrote: > On Thu, Dec 8, 2011 at 10:22 PM, K.-Michael Aye wrote: > > I am still perplexed about decorators though, am happily using Python for > > many years without them, but maybe i am missing something? > > For example in the above c

Re: I love the decorator in Python!!!

2011-12-09 Thread Francesco Bochicchio
On 8 Dic, 12:22, K.-Michael Aye wrote: > On 2011-12-08 08:59:26 +, Thomas Rachel said: > > > > > Am 08.12.2011 08:18 schrieb 8 Dihedral: > >> I use the @ decorator to behave exactly like a c macro that > >> does have fewer side effects. > > >> I am wondering is there other interesting meth

Re: I love the decorator in Python!!!

2011-12-09 Thread Thomas Rachel
Am 08.12.2011 12:43 schrieb Chris Angelico: On Thu, Dec 8, 2011 at 10:22 PM, K.-Michael Aye wrote: I am still perplexed about decorators though, am happily using Python for many years without them, but maybe i am missing something? For example in the above case, if I want the names attached to

Re: I love the decorator in Python!!!

2011-12-09 Thread Robert Kern
On 12/9/11 5:02 AM, alex23 wrote: On Dec 9, 2:38 am, Chris Angelico wrote: One piece of sophistication that I would rather like to see, but don't know how to do. Instead of *args,**kwargs, is it possible to somehow copy in the function's actual signature? I was testing this out in IDLE, and the

Re: I love the decorator in Python!!!

2011-12-08 Thread alex23
On Dec 9, 2:38 am, Chris Angelico wrote: > One piece of sophistication that I would rather like to see, but don't > know how to do. Instead of *args,**kwargs, is it possible to somehow > copy in the function's actual signature? I was testing this out in > IDLE, and the fly help for the function no

Re: I love the decorator in Python!!!

2011-12-08 Thread Ethan Furman
Chris Angelico wrote: One piece of sophistication that I would rather like to see, but don't know how to do. Instead of *args,**kwargs, is it possible to somehow copy in the function's actual signature? I was testing this out in IDLE, and the fly help for the function no longer gave useful info a

Re: I love the decorator in Python!!!

2011-12-08 Thread Ethan Furman
Chris Angelico wrote: One piece of sophistication that I would rather like to see, but don't know how to do. Instead of *args,**kwargs, is it possible to somehow copy in the function's actual signature? I was testing this out in IDLE, and the fly help for the function no longer gave useful info a

Re: I love the decorator in Python!!!

2011-12-08 Thread Ian Kelly
> One piece of sophistication that I would rather like to see, but don't > know how to do. Instead of *args,**kwargs, is it possible to somehow > copy in the function's actual signature? I was testing this out in > IDLE, and the fly help for the function no longer gave useful info > about its argum

Re: I love the decorator in Python!!!

2011-12-08 Thread Andrew Berg
Decorators are great for adding common functionality to several functions without duplicating code. For example, I have one for my IRC bot that checks that the person sending the command is authorized to use the command. It's only "if mask in owner list then execute function else say access denied"

Re: I love the decorator in Python!!!

2011-12-08 Thread Andrew Berg
On 12/8/2011 10:38 AM, Chris Angelico wrote: > One piece of sophistication that I would rather like to see, but don't > know how to do. Instead of *args,**kwargs, is it possible to somehow > copy in the function's actual signature? I remember seeing this in a PEP that is planned to be implemented i

Re: I love the decorator in Python!!!

2011-12-08 Thread Chris Angelico
On Fri, Dec 9, 2011 at 3:24 AM, K.-Michael Aye wrote: > I understand this one, it seems really useful. And maybe i start to sense > some more applicability. Like this, with extra flags that could be set at > run time, I could influence the way a function is executed without designing > the functio

Re: I love the decorator in Python!!!

2011-12-08 Thread K . -Michael Aye
On 2011-12-08 11:43:12 +, Chris Angelico said: On Thu, Dec 8, 2011 at 10:22 PM, K.-Michael Aye wrote: I am still perplexed about decorators though, am happily using Python for many years without them, but maybe i am missing something? For example in the above case, if I want the names atta

Re: I love the decorator in Python!!!

2011-12-08 Thread Chris Angelico
On Thu, Dec 8, 2011 at 10:22 PM, K.-Michael Aye wrote: > I am still perplexed about decorators though, am happily using Python for > many years without them, but maybe i am missing something? > For example in the above case, if I want the names attached to each other > with a comma, why wouldn't I

Re: I love the decorator in Python!!!

2011-12-08 Thread K . -Michael Aye
On 2011-12-08 08:59:26 +, Thomas Rachel said: Am 08.12.2011 08:18 schrieb 8 Dihedral: I use the @ decorator to behave exactly like a c macro that does have fewer side effects. I am wondering is there other interesting methods to do the jobs in Python? In combination with a generator,

Re: I love the decorator in Python!!!

2011-12-08 Thread Chris Angelico
On Thu, Dec 8, 2011 at 7:59 PM, Thomas Rachel wrote: > Many other things are thinkable... And many more are unthinkable. Can we start an International Obfuscated Python Code Contest? It's the only place such... abhorrences can properly flourish. ChrisA -- http://mail.python.org/mailman/listinfo

Re: I love the decorator in Python!!!

2011-12-08 Thread Thomas Rachel
Am 08.12.2011 08:18 schrieb 8 Dihedral: I use the @ decorator to behave exactly like a c macro that does have fewer side effects. I am wondering is there other interesting methods to do the jobs in Python? In combination with a generator, you can do many funny things. For example, you ca

Re: I love the decorator in Python!!!

2011-12-08 Thread Chris Rebert
On Wed, Dec 7, 2011 at 11:18 PM, 8 Dihedral wrote: > I use the @ decorator to behave exactly like a c macro that > does have fewer side effects. > > I am wondering is there other interesting methods to do the > jobs in Python? * Class decorators (http://www.python.org/dev/peps/pep-3129/ ); i.

I love the decorator in Python!!!

2011-12-07 Thread 88888 Dihedral
I use the @ decorator to behave exactly like a c macro that does have fewer side effects. I am wondering is there other interesting methods to do the jobs in Python? A lot people complained that no macro in Python. Cheers to the rule of Python : If there's none then just go ahead and build