This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

About Placeholder

Operator overloading for fast anonymous functions.

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 in functional programming, and resembles Scala’s placeholders.

>>> __[key]
operator.itemgetter(key)

>>> __.name
operator.attrgetter('name')

>>> 1 + __
(1).__add__

>>> __ - 1
(1).__rsub__

>>> -__
operator.neg

An F expression extends placeholders with function composition, but at a slight performance cost. They can be created explicitly from a function, or implicitly through operators as with placeholders.

>>> F(len) + 1
lambda obj: len(obj) + 1

>>> (___ * 2) + 1
lambda obj: obj * 2 + 1

__ and ___ are placeholder and F singletons which can be imported from the module, but each can of course be instantiated and bound to any desired name.

See tests for more example usage.

Installation

Standard installation from pypi or local download.

$ pip install placeholder
$ python setup.py install

Dependencies

Python 2.7 or 3.3+.

Tests

100% branch coverage.

$ py.test [--cov]

Changes

0.5

  • Unary operators
  • __call__ implements methodcaller
  • __getitem__ supports only single argument
  • Improved error handling
  • composer object depecated in favor of optimized F expression
Release History

Release History

0.5

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.4.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.4

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
placeholder-0.5.tar.gz (4.3 kB) Copy SHA256 Checksum SHA256 Source Sep 5, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting