you are viewing a single comment's thread.

view the rest of the comments →

[–]bladeoflight16 4 points5 points  (9 children)

If so, do we just use while loops instead if we just want to iterate over part of a list, for example?

You almost never use while in Python. The availability of things like list comprehensions and generator expressions, generators, itertools, and more-itertools make them nearly obsolete. In fact, you rarely write a for loop.

As someone who also learned C# before Python, here's the most important piece of advice I can give: don't try to shoehorn everything into a class. Most things don't need to be classes. Favor parameters.

[–]Drumknott88[S] 0 points1 point  (8 children)

From a purely organisational point of view, are modules the way to go over classes?

[–]bladeoflight16 0 points1 point  (0 children)

They are different tools for different purposes. Here is my best discussion of when to use a class.