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. If 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, None, doc)

record = X509(LDAP())
record.CN = 'Slate Rock and Gravel Company'

Documentation

For further details please refer to the API Documentation.

Changelog

1.7 - 2023-09-14

  • Update tox.ini for latest tox. [stefan]

  • Add GitHub CI workflow. [stefan]

  • Add .readthedocs.yaml file. [stefan]

  • Pin sphinx and sphinx-rtd-theme versions in docs extra. [stefan]

1.6 - 2022-03-09

  • Add Python 3.8-3.10 to tox.ini. Remove old Python versions. [stefan]

  • Replace deprecated python setup.py test in tox.ini. [stefan]

  • Remove deprecated test_suite from setup.py. [stefan]

  • Move metadata to setup.cfg and add a pyproject.toml file. [stefan]

  • Include tests in sdist but not in wheel. [stefan]

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.

Source Distribution

apply-1.7.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

apply-1.7-py2.py3-none-any.whl (3.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file apply-1.7.tar.gz.

File metadata

  • Download URL: apply-1.7.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.2

File hashes

Hashes for apply-1.7.tar.gz
Algorithm Hash digest
SHA256 91fdcdc7bb8a0b976ac55bac4372d93c82911e695858731fece05b9dbfe63833
MD5 8b01ca12017449b8f475b64cd907714a
BLAKE2b-256 7416039da9c28eed267b3cfe451dab87dce538a7d8abf68e5e8e565968e1f049

See more details on using hashes here.

File details

Details for the file apply-1.7-py2.py3-none-any.whl.

File metadata

  • Download URL: apply-1.7-py2.py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.2

File hashes

Hashes for apply-1.7-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ad8917b5e1a0b8ae12dbcd8a34f3e0c4ebecf9fb1e13b5a8fd4190d6a4a02bf3
MD5 b274f87134d2f98759d8fe0ea70d108b
BLAKE2b-256 d4fdd0f381b9b70421861d57fa41602ea2ca3d21a2c38d3a8071d78dcdec1a73

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page