Skip to main content
# Forwardable

pythoniac port forwardable from Ruby


## Installation

```bash
$ pip install https://github.com/hachibeeDI/forwardable/archive/master.zip
```


## Example

### delegator

```python
>>> from forwardable import Forwardable, def_delegator
>>> class Hoge(object):
... __metaclass__ = Forwardable
... startswith = def_delegator('aa')
... endswith = def_delegator('aa')
... balse = def_delegator('aa', 'replace') # with proxy
...
... def __init__(self):
... self.aa = 'test hoge'

>>> h = Hoge()
>>> h.startswith('test')
True
>>> h.endswith('test')
False
>>> h.balse('test', 'is it greeeeet')
'is it greeeeet hoge'

```

### multi delegators

```python

>>> from forwardable import Forwardable, def_delegators
>>> class Foo(object):
... __metaclass__ = Forwardable
... _ = def_delegators('aa', ('startswith', 'endswith', 'replace', ))
...
... def __init__(self):
... self.aa = 'test hoge'

>>> f = Foo()
>>> f.startswith('test')
True
>>> f.endswith('test')
False
>>> f.replace('test', 'is it greeeeet')
'is it greeeeet hoge'

```

## Testing

```bash
python tests.py
```

Metadata

Release files for forwardable.py 0.0.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for forwardable.py 0.0.11
File Size Uploaded
forwardable.py-0.0.11.tar.gz 2.9 kB Details

Release files / forwardable.py-0.0.11.tar.gz

Download URL forwardable.py-0.0.11.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6759ec30430c476fae27b1a4f8a1f6761b416c118187e8d3fe6adc62e6ee827f
BLAKE2b-256 checksum
How to use checksums
1bc86daccc28c6fc99696d4decf174689e64e0ce55cddaab34d8c9f07991fd21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.0.11 This release

1 release file

0.0.3

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page