To avoid getting lost in architectural decisions, I'll ask this with an analogous example:
lets say I wanted a Python class pattern like this:
queue = TaskQueue(broker_conn)
queue.region("DFW").task(fn, "some arg")
The question here is how do I get a design a class such that certain methods can be "chained" in this fashion.
task()
would require access to the queue
class instance attributes and the operations of task
depends on the output of region()
.
I see SQLalchemy does this (see below) but am having difficulty digging through their code and isolating this pattern.
query = db.query(Task).filter(Task.objectid==10100)