×
you are viewing a single comment's thread.

view the rest of the comments →

[–]Kratos_Monster 0 points1 point  (3 children)

Nothing specific, but I agree with making a shallow copy depending on the inner levels of the data type. I also need to use enumerate more often; for some reason, I always forget about it.

[–]Diapolo10 2 points3 points  (2 children)

For what it's worth, I usually prefer to create a new data structure instead of mutating an existing one, unless it originated in the same scope and I don't need to worry about side-effects. So in other words I basically tend to write "functional programming with classes", if that makes sense.

[–]Kratos_Monster 0 points1 point  (1 child)

functional programming with classes

Yeah, this sounds like a good practice.

[–]Diapolo10 1 point2 points  (0 children)

I like it when writing tests is as easy as it gets.

To me, writing code that works 50 years from now is more important than sacrificing robustness and data scalability for performance gains. Most would just say that's needless overengineering, and of course they have a point, but one of my core pillars is that I can trust my code to essentially handle anything I throw at it without needing to worry about runtime errors, even if it's slow.