4 ms·
It is useful: When iterating over a string in Python (which I hope you agree _is_ useful?), you get that many parts.
by L3viathan 3y ago
It is useful: When iterating over a string in Python (which I hope you agree _is_ useful?), you get that many parts.
- chrismorgan 3y ago> When iterating over a string in Python (which I hope you agree _is_ useful?) Not often. There’s almost nothing useful you can correctly do with a sequence of code points.
- masklinn 3y ago> It is useful: When iterating over a string in Python (which I hope you agree _is_ useful?), you get that many parts. That’s… not useful? I can’t say I remember ever caring knowing how many items I would be getting during an iteration[0]. If I want to set an iteration limit I can just… do that, using `islice` or some such. [0] in python anyway, in lower level language there can be a utility in order to pre-allocate an output collection
- deleted 3y ago[deleted]