An apply function for Python 2 and 3
Project description
Package Contents
- apply(object, args=None, kwargs=None)
Call object with args and kwargs; return its results.
Overview
Python 3 has no apply. We like apply. I you like apply as well, have no fear. This version of apply works across all versions of Python.
Examples
apply allows to create read/write properties in a very compact way:
from apply import apply class X509: def __init__(self, store): self.store = store @apply def CN(): doc = 'The common name attribute' def get(self): return self.store.get('CN') def set(self, value): self.store.put('CN', value) return property(get, set, doc=doc) record = X509(LDAP()) record.CN = 'Slate Rock and Gravel Company/emailAddress=cert@slaterock.com'
Changelog
1.2 - 2011-11-26
Update README. [stefan]
1.1 - 2011-11-26
Fix function signature. [stefan]
1.0 - 2011-11-25
Initial release. [stefan]
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
apply-1.2.zip
(5.5 kB
view details)
File details
Details for the file apply-1.2.zip
.
File metadata
- Download URL: apply-1.2.zip
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4547e1dc4a735930595affa5938a5e9c620773e45fe99b9c57467a03fb56d3f3 |
|
MD5 | 3dd2c0472c2dd326d992ff96512820e9 |
|
BLAKE2b-256 | 1282890a53920249f28784db5fe15013b4b849a639806046a80d7861e71871b7 |