optype for toolz and cytoolz: ambitious or foolish?
#784
-
|
In Z0Z_tools, I've been modernizing and adding type annotations to I haven't used optype before. If I were to raise the Python minimum to 3.12, would optype be a good fit for these packages? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Awesome 💪
Yea definitely! For example, And for For the However, optype won't help everywhere. For example the rather involved |
Beta Was this translation helpful? Give feedback.
Awesome 💪
Yea definitely!
For example,
itertoolz.pluckanditertoolz.getaccepts anything with a__getitem__method, sooptype.CanGetitem[K, V]would be the most correct solution (Sequence/Mappingneedlessly require a bunch of extra methods like__len__and__contains__to be present, even though these aren't used at all).And for
itertools.merge_sortedand othersorted-like functions such astopkonly require the items to be comparible, for whichoptype.CanLtandoptype.CanGta…