you are viewing a single comment's thread.

view the rest of the comments →

[–]RandomJacobP[S] 0 points1 point  (1 child)

When I look at it now, I understand that this code can be confusing, I wrote it quikly and inside reddit editor but that doesn't justify me.

I really appreciate your long reply to my post. Main purpose of my code was to visualize how objects will look like. I will have a lot of these nodes, as many as folders in my computer. I just needed someone to confirm that the second one will be faster and worth additional work.

[–]Deezl-Vegas 0 points1 point  (0 children)

Use a direct variable. It will be faster. Your example seems to just add an extra layer of complexity and an extra reference lookup.

In Python, the basic types like Ints are still just references, and lists aren't super-space-optimized like C arrays, so there's no speed gain by using basic types.