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

Aaron Brady castironpi at comcast.net
Thu Jan 24 23:26:00 CET 2008

> 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 )

1.	parseAB= partial( default_scheme= 'ftp', allow_fragments= True )
2.	retrieveAB= partial( filename= 'temp.htm', reporthook= callbackA )

Equivalent calls:
1.	parseA( 'www.cwi.nl/%7Eguido/Python.html' )
2.	retrieveA( 'http://python.org/' )

- Programmer time is important
- The stdlib does not contain application-level design

More information about the Python-ideas mailing list