Skip to main content

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'

Documentation

For further details please refer to the API Documentation.

Changelog

1.5 - 2019-01-28

  • Add MANIFEST.in. [stefan]
  • Release as wheel. [stefan]

1.4 - 2017-02-05

  • Support Python 2.6-3.6 without 2to3. [stefan]
  • Add a LICENSE file. [stefan]

1.3 - 2014-04-19

  • Remove setuptools from install_requires because it isn’t. [stefan]

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.

Files for apply, version 1.5
Filename, size File type Python version Upload date Hashes
Filename, size apply-1.5-py2.py3-none-any.whl (4.0 kB) File type Wheel Python version 3.7 Upload date Hashes View
Filename, size apply-1.5.zip (7.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page