Function structuring tools #9
thorwhalen
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Why
When we write code using python objects, then dispatch some of these to a webservice (py2http), and then get python wrappers of the latter (http2py), we'd like to be able to use the original code as is (as much as possible).
But when we do the py2http2py, python objects are normalized. Amongst other things, we "flatten" nested structures. We'd like to be able to "restructure" these flat functions.
Examples
Instance methods
When we make an instance of a class and use it's methods:
This sequence gets flattened to a single function that can be used as such
It's functional (pun), but we'd like to be able to have the choice of creating a
WsClassthat uses func to offer the same interface:Stores (Mappings)
The dol ecosystem (py2store, etc.) allows us to write code where CRUD operations have a normalized interface. We can read data doing
v = store[k], write doingstore[k] = v, delete doingdel store[k]etc. with storage details abstracted away.So being able to create web services for stores (i.e.
MutableMappinginterfaces) and visa-versa being able to get the same store interface wrapped over these web-services can go a long way.How
Using
i2.wrapper, writeingressandegressfunction factories specialized for the restructuring purpose.Beta Was this translation helpful? Give feedback.
All reactions