Re: [Python-ideas] An easier syntax for writing decorators(&similar things)?

On Jan 24, 2008 3:26 PM, Aaron Brady <castironpi@comcast.net> wrote:
This is closer to what I'm asking for but these are still not instances of real code[1]. To build a convincing argument for a new language feature, you need to show not only a theoretical use case, but a practical one. In general, that means you need to show that it is a frequent need in a large code base. Finding a bunch of examples of it in the standard library or big applications like Zope or Twisted would be a good start. This is something that's expected of any PEP-worthy idea. [1] I know you didn't copy these from real code anywhere because they all have typos -- they're missing urlparse/urlretrieve as the first arguments to partial() or prepartial(). STeVe -- I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a tiny blip on the distant coast of sanity. --- Bucky Katt, Get Fuzzy

Repair treated. Original function: 1. urlparse( urlstring[, default_scheme[, allow_fragments]]) 2. urlretrieve( url[, filename[, reporthook[, data]]]) In action: 1. parseA= prepartial( urlparse, 'ftp', False ) 2. retrieveA= prepartial( urlretrieve, 'temp.htm', callbackA ) Equivalent A: 1. parseAB= partial( urlparse, default_scheme= 'ftp', allow_fragments= False ) 2. retrieveAB= partial( urlretrieve, filename= 'temp.htm', reporthook= callbackA ) Equivalent B: 1. parseAC= lambda url: urlparse( url, 'ftp', False ) 2. retrieveAC= lambda url: urlretrieve( url, 'temp.htm', callbackA ) Examples in gestation; check back in several months; a +fraction; you're on the right track.

Repair treated. Original function: 1. urlparse( urlstring[, default_scheme[, allow_fragments]]) 2. urlretrieve( url[, filename[, reporthook[, data]]]) In action: 1. parseA= prepartial( urlparse, 'ftp', False ) 2. retrieveA= prepartial( urlretrieve, 'temp.htm', callbackA ) Equivalent A: 1. parseAB= partial( urlparse, default_scheme= 'ftp', allow_fragments= False ) 2. retrieveAB= partial( urlretrieve, filename= 'temp.htm', reporthook= callbackA ) Equivalent B: 1. parseAC= lambda url: urlparse( url, 'ftp', False ) 2. retrieveAC= lambda url: urlretrieve( url, 'temp.htm', callbackA ) Examples in gestation; check back in several months; a +fraction; you're on the right track.
participants (2)
-
Aaron Brady
-
Steven Bethard