I am writing functions for the PySpark command RDD.aggregate
which asks for the following parameters: aggregate(zeroValue, seqOp, combOp)
.
Can I use mutable objects for all of these parameters, without messing up the logic?
Basically for efficiency I expect calls to something like
zeroValue.add(other)
def seqOp(x1, x2): return x1.add(x2)
def seqOp(x1, x2): return x1.combine(x2)
All of the methods will return self
. This way I do not have to re-allocate objects.