Skip to main content

My personal functions.

Project description

My choice of missing python functions.

list.len()
list.map(function)
list.filter(function)
list.compact()
list.uniq()
list.take(num)
list.drop(num)
list.flatten()
list.each_cons(num)
list.each_slice(num)
list.max()
list.min()
list.sum()
list.zip()
list.first()
list.last()
list.freq(function=None)
list.groupby(function=None)
list.indexby(function=None)
list.join(separator)
list.sortby(function)
list.sorted()
list.reduce(function)
list.reduce(initial, function)
list.percentile(float)
list.percentiles(*float)

tuple.len()
tuple.map(function)
tuple.max()
tuple.min()
tuple.sum()
tuple.zip()
tuple.first()
tuple.last()
tuple.freq(function=None)
tuple.groupby(function=None)
tuple.indexby(function=None)
tuple.join(separator)
tuple.sortby(function)
tuple.sorted()
tuple.reduce(function)
tuple.reduce(initial, function)
tuple.percentile(float)
tuple.percentiles(*float)

dict.len()
dict.compact()

Examples

$ python
>>> import omakase
>>> array = 'the quick brown fox jumps over the lazy dog'.split()
>>> array.map(len)
[3, 5, 5, 3, 5, 4, 3, 4, 3]
>>> array.filter(lambda each: each > 'hello worlds')
['the', 'quick', 'jumps', 'over', 'the', 'lazy']
>>> array.take(3)
['the', 'quick', 'brown']
>>>

Installation

To install this package, run

pip install omakase

Contributing

Bug reports and pull requests are welcome on github at, https://github.com/akuhn/py-omakase

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

omakase-1.1.0.tar.gz (2.3 kB view details)

Uploaded Source

File details

Details for the file omakase-1.1.0.tar.gz.

File metadata

  • Download URL: omakase-1.1.0.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.10.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.19.8 CPython/2.7.10

File hashes

Hashes for omakase-1.1.0.tar.gz
Algorithm Hash digest
SHA256 4abfbacea6cf49a288dc7613cb895f12ff7d2be2309c6e516ee850854a51f51b
MD5 8373dc72008491924a779af829cb3307
BLAKE2b-256 f86e70f7b595e0696df4163f62ff047d526b5423c45c23dcce7daecede6a90b2

See more details on using hashes here.

Supported by

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