[Python-ideas] An easier syntax for writing decorators(&similar things)?
Steven Bethard
steven.bethard at gmail.com
Fri Jan 25 01:22:41 CET 2008
On Jan 24, 2008 3:26 PM, Aaron Brady <castironpi at comcast.net> wrote:
> > I don't consider that a use case, or real code. ;-) Yes, you can
> > construct curry with it. But what do you want to use curry for? Show
> > me some actual Python packages that use the curry function (or your
> > prepartial function) and then we can talk.
>
> Original function:
> 1. urlparse( urlstring[, default_scheme[, allow_fragments]])
> 2. urlretrieve( url[, filename[, reporthook[, data]]])
>
> Prepartial in action:
> 1. parseA= prepartial( 'ftp', False )
> 2. retrieveA= prepartial( 'temp.htm', callbackA )
>
> Equivalent:
> 1. parseAB= partial( default_scheme= 'ftp', allow_fragments= True )
> 2. retrieveAB= partial( filename= 'temp.htm', reporthook= callbackA )
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
More information about the Python-ideas
mailing list