How do you chunk data? We came up with the below snippet. It works (with
integer list data) for our needs, but it seems so clunky.
def _chunks(lst: list, size: int) -> list:
return [lst[x:x+size] for x in range(0, len(lst), size)]
What do you do? Also, what about doing this lazily
Can anyone provide some simple example/s or two or three of using weakref?
I'm baffled and not seeing any documentation that is meaningful. My
interest is to minimize memory usage (generally speaking, overall) and am
wondering if this might help.
--- We not only inherit the Earth from our
How might I best make a linked list subscriptable? Below is skeleton code
for a linked list (my
actual is much more). I've done __iter__ and __next__ but I would like to
be able to do start:stop:stride I just can't figure out how. Suggestions or
just hints please?
# -*- coding: utf8 -*-
class