placeholder 0.3.1
Operator overloading for fast anonymous functions.
Latest Version: 0.4
A placeholder object uses operator overloading to create partially bound functions on-the-fly. When used in a binary expression, it will return a callable object with the other argument bound. It's useful for replacing lambda when doing functional programming. For example:
- __[key] == operator.itemgetter(key)
- __.name == operator.attrgetter('name')
- (1 + __) == (1).__add__ or partial(operator.add, 1)
- (__ - 1) == (1).__rsub__ or lambda obj: obj - 1
where '__' is a placeholder instance (it can have any name of course).
See tests for more example usage. Supported on Python 2.5 or higher, including Python 3.x.
| File | Type | Py Version | Uploaded on | Size | # downloads |
|---|---|---|---|---|---|
| placeholder-0.3.1.tar.gz (md5) | Source | 2009-05-11 | 2KB | 582 | |
- Author: Aric Coady
- Categories
- Package Index Owner: coady
- DOAP record: placeholder-0.3.1.xml
