Changelog
Development
Added
TextWrapper.{int, float, ord}()
, to convert strings to numbers.Document integration of external libraries
2.1.1
Fix typo in operator ror that prevented it from working.
2.1
Wrapper.self
will now always go back in the chain to the base of the last call, instead of onyl when the last callable returnedNone
. This should fix the possible behaviour change when methods sometimes return None and sometimes a usefull value.Fixed inconsistencies on how
CallableWrapper.curry()
deals with too many arguments. In Python this leads to aTypeError
- and now it does here too.Fixed bug that
_._args
behaved differently than documented. The documentation stated that_(lambda x, y=3: x).curry(_._args)(1, 2)._ == (1, 2)
but it did instead returntuple(1)
Add
__rmul__
and friends support on_._each
to allow expressions like4 % _._each
to work.
2.0
Breaking changes
IterableWrapper.iter()
now returns unwrapped instances. This was changed for uniformity, as all other ways to iterate through a wrappedIterableWrapper
returned unwrapped instances.Removed
Wrapper.tee()
andItertools.tee()
as_(something).tee(a_function)
is easily replicable by_(something).call(a_function).previous
andIterableWrapper.tee()
prevented me from providingitertools.tee
.Wrapper.type()
returns a wrapped type for consistency.Wrapper.{tuplify,listify,dictify,setify}
have been removed, useWrapper.call(a_type)
for a wrapped orWrapper.to(a_type)
for an unwrapped result instead._.each
now supports auto chaining of operations. That means you can type_.each.foo['bar'].baz('quoox')._
to generate a function that applies all of these operations in order. This also means that all functions generated from_.each
need to be unwrapped (._
) before usage!_.each.call
is removed, as_.each.method('arg')
now works as expected, so_.each.call
is not neccessary any more.
Notable Changes
CallableWrapper.curry()
now supports converting positional arguments to keyword arguments.IterableWrapper.each()
to apply a function to every element just for the side effect while chaining off of the original value.EachWrapper.in_(haystack)
andEachWrapper.not_in(haystack)
support to mimiklambda each: each in haystack
.All the top level classes have been renamed to have a common -
Wrapper
suffix for consistency and debuggability.Added new method
.to(a_type, *args, **kwargs)
that callsa_type(self, **args, **kwars)
but returns an unwrapped result, to more smothely terminate call chains in common scenarios.