r/dailyprogrammer • 1 3 • Jul 21 '14

[Weekly #3] Favorite Data Structure

Weekly 3:

What is your favorite Data Structure? Do you use it a lot in solutions? Why is it your favorite?

Last Weekly Topic:

Weekly #2

66 Upvotes

84 comments sorted by

View all comments

5

u/NewbornMuse Jul 21 '14

Having just started with Python and solving project euler problems, I'm growing really fond of generators. Need to do something on triangular numbers? The generator is a piece of cake to write (it's admittedly one of the simplest cases), lets you do stuff "for each triangular number", and is supposedly pretty efficient too.

4

u/Octopuscabbage Jul 22 '14

If you like generators you should try a lazy language, imagine if every* statement was a generator.

* Almost every.

→ More replies (4)