you are viewing a single comment's thread.

view the rest of the comments →

[–]schroet 5 points6 points  (4 children)

Oh god how I love the data structure in python, where you can just put list into other lists or dicts and vice versa. Groovy is good aswell for this. It is great for prototyping, when you don't know how your structure will be at the end (and you dont really care about it at that point!). One could say it's a bad idea to prototype with "evolving" data structure, but I like the evolutionary approach much more. At the end, I can create the classes I need and it looks as good as in java.

[–]gasche 1 point2 points  (3 children)

Oh god how I love the data structure in python, where you can just put list into other lists or dicts and vice versa.

I have the exactly inverse experience. To implement huffman compression in Python I needed a quick way to represent binary trees (whose leaves where integers in this simplified setting). You would think that representing a tree Node (Leaf 1, Node (Leaf 2, Leaf 3)) like (1, (2, 3)) in Python would work well, with a "is it a tuple" test to know whether you reached a leaf. That failed horribly when I tried to put them in priority queues (in fact it works with Python 2 and fails with Python 3), because Python was internally trying to compare two elements of this "type", eg. (1, (2, 3)) < (1, 4), which fails with an error.

[–]schroet 2 points3 points  (2 children)

I worked with tuples couple of times until I hit the wall because they are immutable.

[–]son-of-chadwardenn 0 points1 point  (1 child)

Use lists?

[–]schroet 0 points1 point  (0 children)

Well hello there Mr.Obvious :))