infixpy
See blog post, Introducing infixpy: Scala-inspired data structures for Python to learn about using this library.
A functional, object-oriented approach for working with sequences and collections. Also similar to Spark RDDs and Java Streams. Hope you find they simplify your code by providing a plethora of common algorithms for working with sequences and collections.
Stephen's Direct from Scala example
Scala version
val a = ((1 to 50)
.map(_ * 4)
.filter( _ <= 170)
.filter(_.toString.length == 2)
.filter (_ % 20 == 0)
.zipWithIndex
.map{ case(x,n) => s"Result[$n]=$x"}
.mkString(" .. "))
a: String = Result[0]=20 .. Result[1]=40 .. Result[2]=60 .. Result[3]=80
Version using the infixpy library with python
from infixpy import *
a = (Seq(range(1,51))
.map(lambda x: x * 4)
.filter(lambda x: x <= 170)
.filter(lambda x: len(str(x)) == 2)
.filter( lambda x: x % 20 ==0)
.enumerate()
.map(lambda x: 'Result[%d]=%s' %(x[0],x[1]))
.mkstring(' .. '))
print(a)
# Result[0]=20 .. Result[1]=40 .. Result[2]=60 .. Result[3]=80
Original Example
from infixpy import Seq
(Seq(range(10))
.map(lambda x: x+3)
.filter(lambda x: x%2==0)
.groupby(lambda x: x%3)
.keys()
.foreach(print))
Output
1
0
2
Examples
See examples/ directory for additional examples of using infixpy.
Also see example usages in career_village_entities.
Metadata
Release files for infixpy 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| infixpy-0.4.0.tar.gz | 9.0 kB | Without provenance | Details for infixpy-0.4.0.tar.gz |
Release files / infixpy-0.4.0.tar.gz
| Download URL | infixpy-0.4.0.tar.gz |
|---|---|
| Size | 9.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
89c0488b560fced907c8f1229d67ebb491f076d8658b54ff66aa356a396dfc6c
|
|
BLAKE2b-256 checksum How to use checksums |
a08604796154c81f35f5cab605fe4886ace2f508c22d3479ff713b0a073319e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.8
|
Security for infixpy 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.