r/learnpython • • Aug 16 '16

Beginner's Python cheat sheets - updated

In the spring I posted a set of cheat sheets aimed at beginners, and many people found them useful. I've since completed the set of sheets, and wanted to share the full set. The additional sheets cover files and exceptions, testing, Pygame, matplotlib, Pygal, and Django.

You can download individual sheets, or download a pdf that includes all the sheets in one document. These sheets aim to remind you of Python's syntax, but they also include brief explanations of the concepts behind the syntax as well.

I wrote these sheets as supporting documentation for readers of Python Crash Course, but I think they're useful for beginners in general. I hope you find them helpful, and I'm happy to answer any questions about them.

447 Upvotes

52 comments sorted by

View all comments

1

u/TamSanh Aug 17 '16

I believe your classes example in the full document is wrong. All classes should inherit from object.

class Dog(object):
    pass

2

u/zahlman zahlman Aug 17 '16

This is only in 2.x. In 3.x it happens anyway.

1

u/TamSanh Aug 17 '16

So if the syntax is superfluous in 3.x and meaningful in 2.x, it should be always done, no?

3

u/zahlman zahlman Aug 17 '16

I would say no, because I want to encourage people to migrate to 3.x. "Explicit is better than implicit" doesn't mean you have to say things that are obvious and assumed by default. There are way too many of those.

1

u/TamSanh Aug 17 '16

If that's the case, then recommend specifying in your documentation explicitly that it's a cheat sheet for 3.x. The only version references are your python book plug that says "Covers Python 3 and 2." Of course, maybe it's just so obvious that it's a cheat sheet for 3.x, or I should have assumed it by default; but I didn't.