2
lungdart
20d

Am I the only person who thinks the zip function in python is awful? It always results in such fragile programming patterns

Comments
  • 2
    @retoor people seem to use it in for loops when they want to iterate over two structures that relate to each other.

    Frequently the structures misalign and cause bugs.

    Better data design usually fixes it.
  • 2
    @lungdart yeah, I agree. I mean the zip function itself is not awful. It does what it‘s supposed to do.

    But, I used the zip function only once in my life and it felt very hacky. I think you can take it as a smell for bad code and should consider a refactoring.
  • 1
    Syracuse me, but who the fuck iterates over two arrays without being sure they are the same size? The same people that need the compiler to handle memory safety, I take it? Is thinking too much trouble? Am I beyond any shred of doubt old, delirious and grumpy? Are these too many questions? Am I just fucking with you? Does this ever end? Is a two-way map real or are we more into threesomes? Why can't I find the remote? Do you get it yet? Are we to enjoy a good old whiff of you-know-who's? Is this getting old? How long can I keep it up without being bored? Am I sleep deprived, perhaps? Most certainly.
  • 1
    @Liebranca if one array has less elements than the other, the result of zip will just operate until it reaches the end of the one which is smaller, so that’s not the issue. This is how it works in Swift at least.

    Regarding your statement about memory safety, I prefer "guaranteed by compiler" over "trust me, bro"
  • 2
    @Lensflare Oh, spare me. Avoiding simultaneous iterations over disparately-sized arrays is mere common sense; chastity belt unrequired due to proper technique -- whether it faults or not becomes unimporant as it's never attempted in the first place. Now go ask Apple for permission to post your app, I've got shit to do.
  • 3
    @Liebranca data scientists.

    From what I can tell, 85% of them are just baboons smashing on a keyboard with jupyter notebook open
  • 2
    @retoor yeah crashing is better than silently failing and compilers are capable of converting future crashes or silent fails into compile time errors, which is even better.
    And they do it rigorously and correctly. You don‘t need to rely on some sleep deprived dev which thinks that he is sure that he did it correctly.
  • 1
    @retoor please make a separate account for your ai. It’s annoying to have both of you in there.
Add Comment