Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #71435

Re: Simple Function Decorator Sample Snippet

From Mark H Harris <harrismh777@gmail.com>
Newsgroups comp.lang.python
Subject Re: Simple Function Decorator Sample Snippet
Date 2014-05-13 01:04 -0500
Organization Aioe.org NNTP Server
Message-ID <lksclm$qqi$1@speranza.aioe.org> (permalink)
References <lks7pd$gd0$1@speranza.aioe.org> <5371b3a7$0$11109$c3e8da3@news.astraweb.com>

Show all headers | View raw


On 5/13/14 12:54 AM, Steven D'Aprano wrote:
> I don't think that this idea is original to you :-) I'm pretty sure many
> people have come up with the idea of a decorator that just announces when
> it runs and when it is called. I know I have  :-)

    oh, absolutely... every piece of that thing comes from somebody 
(about six somebodies to be exact) what makes it unique is that its 
compressed, in the right order (I think), and 'without' extraneous 
gibberish that confuses the whole dang thing.

>
> People keep independently inventing this because it's an obvious, and
> easy to understand, example. Nicely done.

    Its obvious until you get to the @charater.  In fact its taken so 
obviously by *everyone* that no one actually gets it explained without 
eight pages or twelve steps of something until its all confused.


> I tried to run your code, but every line is quoted with a > which causes
> a syntax error. Was there a reason you quoted the snippet?

Yes, because depending on your interface the code can get mangled (the 
indentation thing breaks).  the quoted paste seems to avoid this mostly 
with the downside that the quote characters need to be striped from the 
py file.   <sorry>   by the way, any suggestions are welcome regarding 
that too...  there doesn't really seem to be a good way to share code on 
the group consistently.

marcus

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Simple Function Decorator Sample Snippet Mark H Harris <harrismh777@gmail.com> - 2014-05-12 23:41 -0500
  Re: Simple Function Decorator Sample Snippet Steven D'Aprano <steve@pearwood.info> - 2014-05-13 05:54 +0000
    Re: Simple Function Decorator Sample Snippet Mark H Harris <harrismh777@gmail.com> - 2014-05-13 01:04 -0500
      Re: Simple Function Decorator Sample Snippet alister <alister.nospam.ware@ntlworld.com> - 2014-05-13 11:09 +0000

csiph-web