Recently, there have been a few proposals to change Python's syntax to make it easier to avoid break and continue statements.

The reasoning seems to be that many people are taught never to use break and continue, or to only have a single break in any loop.

1

Sometimes, you need to split a program into two parts.

Look at this familiar code:

class Foo(object): def __init__(self, a): self.a = a def bar(self, b): return self.a + b foo = Foo(1)

How do __init__ and bar get that self parameter?

Unbound methods

Well, bar is just a plain old function.

3

Never call readlines() on a file

Calling readlines() makes your code slower, less explicit, less concise, for absolutely no benefit.

There are hundreds of questions on places like StackOverflow about the readlines method, and in every case, the answer is the same.

6

You don't actually have to be a dummy to not get list comprehensions. Only a few languages (after Python, the next most popular is probably Haskell) support them. And they're only "easy" once you learn to think a different way.

You do eventually want to learn to think that way.

Blog Archive
About Me
About Me
Loading
Dynamic Views theme. Powered by Blogger. Report Abuse.