Lo-Dash Differences¶
Naming Conventions¶
pydash adheres to the following conventions:
- Function names use snake_case instead of camelCase.
- Any Lo-Dash function that shares its name with a reserved Python keyword will have an _ appended after it (e.g. filter in Lo-Dash would be filter_ in pydash.
- Lo-Dash’s toArray() is pydash’s to_list().
- Lo-Dash’s functions() is pydash’s callables(). This particular name difference was chosen in order to allow for the functions.py module file to exist at root of the project. Previously, functions.py existed in pydash/api/ but in v2.0.0, it was decided to move everything in api/ to pydash/. Therefore, In to avoid import ambiguities, the functions() function was renamed.
Callbacks¶
As of v2.0.0, callback functions no longer need to handle all possible arguments. Prior to v2.0.0, callbacks had to define all arguments or have star-args:
# Valid in v1
def mycallback(item, value, obj):
pass
# Valid in v1
def mycallback(item, *args):
pass
# Invalid in v1
def mycallback(item):
pass
But in v2.0.0 partial callback signatures are handled properly:
# Valid in v2
def mycallback(item, value, obj):
pass
# Valid in v2
def mycallback(item, *args):
pass
# Valid in v2
def mycallback(item):
pass
Extra Aliases¶
The following extra function aliases exist in pydash but not in Lo-Dash:
Extra Functions¶
In addition to porting Lo-Dash, pydash contains functions found in lodashcontrib, lodashdeep, and lodashmath.
The following functions exist in pydash but not in Lo-Dash:
- pydash.numerical.add(), pydash.numerical.sum_()
- pydash.arrays.append(), pydash.arrays.push()
- pydash.numerical.average(), pydash.numerical.avg(), pydash.numerical.mean()
- pydash.arrays.cat(), pydash.arrays.concat()
- pydash.functions.conjoin()
- pydash.objects.deep_get()
- pydash.objects.deep_has()
- pydash.objects.deep_map_values()
- pydash.collections.deep_pluck()
- pydash.objects.deep_property(), - pydash.objects.deep_prop()
- pydash.objects.deep_set()
- pydash.functions.disjoin()
- pydash.strings.explode()
- pydash.objects.get_path()
- pydash.objects.has_path()
- pydash.strings.implode()
- pydash.arrays.intercalate()
- pydash.arrays.interleave()
- pydash.arrays.intersperse()
- pydash.predicates.is_associative()
- pydash.predicates.is_even()
- pydash.predicates.is_float()
- pydash.predicates.is_decreasing()
- pydash.predicates.is_increasing()
- pydash.predicates.is_indexed()
- pydash.predicates.is_instance_of()
- pydash.predicates.is_integer()
- pydash.predicates.is_json()
- pydash.predicates.is_monotone()
- pydash.predicates.is_negative()
- pydash.predicates.is_odd()
- pydash.predicates.is_positive()
- pydash.predicates.is_strictly_decreasing()
- pydash.predicates.is_strictly_increasing()
- pydash.predicates.is_zero()
- pydash.functions.iterated()
- pydash.arrays.join()
- pydash.functions.juxtapose()
- pydash.arrays.mapcat()
- pydash.collections.mapiter()
- pydash.numerical.median()
- pydash.numerical.moving_average(), pydash.numerical.moving_avg()
- pydash.arrays.pop()
- pydash.numerical.power(), pydash.numerical.pow_()
- pydash.collections.reductions()
- pydash.collections.reductions_right()
- pydash.objects.rename_keys()
- pydash.arrays.reverse()
- pydash.numerical.round_(), pydash.numerical.curve()
- pydash.numerical.scale()
- pydash.objects.set_path()
- pydash.arrays.shift()
- pydash.numerical.slope()
- pydash.arrays.sort()
- pydash.arrays.splice()
- pydash.arrays.split_at()
- pydash.numerical.std_deviation(), pydash.numerical.sigma()
- pydash.objects.to_string()
- pydash.numerical.transpose()
- pydash.arrays.unshift()
- pydash.objects.update_path()
- pydash.strings.url()
- pydash.numerical.variance()
- pydash.numerical.zscore()
Function Behavior¶
Some of pydash’s functions behave differently:
- pydash.utilities.memoize() uses all passed in arguments as the cache key by default instead of only using the first argument.
Templating¶
- pydash doesn’t have template(). See Templating for more details.