Python library to extend functional operations in the spirit of functional programming in scala. Provides support for missing operations and chain style functional calls.
EntilZha on master
Update DNS (compare)
__str__
and __repr__
could behave differently depending on type of underlying sequence?
Planning on releasing 0.7.0
next week, primary features that will be shipping is the parallel execution engine and file compression support. The main website and docs are now at www.pyfunctional.org and docs.pyfunctional.org respectively (readthedocs can't change scalafunctional.readthedocs.org to pyfunctional.readthedocs.org so this was an easy solution).
The release following this one will most likely be 1.0
, so open to thoughts on what should go in. So far, would like to revamp the readme docs, the webpage at www.pyfunctional.org (currently a clone of the readme), the actual docs, clarify package description, revisit linq, revisit underscore, revisit supporting more than just sqlite, and/or look into adding an option/support to stream things (rather than force open iterables). All this is on top of my head so there could be more
_
operator or pattern matching (that would be really hard to do I think, been looking at existing libraries). Open to suggestions
seq
, but I am working on detecting it as input and doing the correct thing (it gives a list of columns I believe atm but should give a list of rows)
@EntilZha thank you for getting back. The use case I had in mind (which might already be supported by PyFunctional; I haven't tried, but thought of checking with the community first), for example, is I want to write the code below a bit more "functionally."
# `customer` is a Django model, and has a one-to-many relationship with `circuit`
customer_circuits = customer.circuit_set
circuit_ids_that_violate_constraints = []
for circuit_id, new_bandwidth in new_bandwidths.items():
circuit = customer_circuits.get(cid=circuit_id)
if new_bandwidth < circuit.bandwidth_minimum or new_bandwidth > circuit.bandwidth_maximum:
circuit_ids_that_violate_constraints.append(circuit_id)
The code above could be expressed more "functionally" in ruby, for example, along the lines of (just pseudocoding, please don't take it literally):
circuit_ids_that_violate_constraints = circuits
.select({|circuit| new_bandwidth < circuit.bandwidth_minumum})
.select({|circuit| new_bandwidth > circuit.bandwidth_maximum})
.map({|circuit| circuit.cid})
@EntilZha
Do you know this smart_open library?
https://github.com/RaRe-Technologies/smart_open
I think seq.open
can use this library as backend to support S3 or HDFS and remove gzip or bzip2 related codes.
csv.reader
is being used in the seq.csv
so if its not possible to pass the right parameters to that then it might make sense to add another method like seq.csv_dict
etc
csv.DictReader
makes each row a named tuple according to a list of field names or if thats not given then the first row of the csv file. Seems like having another method is good here, question is what to name it.
map(lambda cell: [cell, cell_level, user_input.area_name]).to_csv('/tmp/test.csv' ,mode='wa').
File "/usr/local/lib/python2.7/dist-packages/functional/pipeline.py", line 1498, in to_csvmap(lambda cell: [cell, cell_level, user_input.area_name]).to_csv('/tmp/test.csv' ,mode=u'a').
File "/usr/local/lib/python2.7/dist-packages/functional/pipeline.py", line 1501, in to_csv