Skip to main content

Perl 6 like Whatever object.

Project description

An easy way to make lambdas by partial application of python operators.

Inspired by Perl 6 one, see http://perlcabal.org/syn/S02.html#The_Whatever_Object

Usage

from whatever import _, that

# get a list of guys names
names = map(_.name, guys)
names = map(that.name, guys)

squares = map(_ ** 2, range(100))
three_digit_squares = filter(100 <= _ < 1000, squares)

best = max(tries, key=_.score)
sort(guys, key=-that.height)

factorial = lambda n: reduce(_ * _, range(1, n))

Last example is not implemented yet.

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

whatever-0.1.tar.gz (3.2 kB view hashes)

Uploaded Source

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