r/Python • • Oct 05 '16

Python Cheat Sheet

https://www.cheatography.com/davechild/cheat-sheets/python/
79 Upvotes

32 comments sorted by

16

u/[deleted] Oct 05 '16

Who is upvoting this? Who isn't reporting it as spam?

-12

u/liranbh Oct 05 '16

spam? if its not plain text its a spam?

4

u/NSAshitlist Oct 05 '16

I'm guessing it would be because it's a horrible list for an outdated version of python we are all trying to move forward from.

42

u/chub79 Oct 05 '16

Looks more like click bait than anything else.

3

u/pyve Oct 05 '16

Indeed, the page even wants permissions to send notifications via Chrome.

1

u/DaveChild Oct 24 '16

People seem to prefer that to email notifications of new cheat sheets. I don't know why - personally I prefer email.

1

u/DaveChild Oct 24 '16

Almost anything useful and free can be called "click bait", I suspect.

19

u/goocy Enthusiast Oct 05 '16

Five separate entries for sys.argv[1:5] seem a bit superfluous.

8

u/[deleted] Oct 05 '16

Especially because there is argparse, which is a very convenient library for making command line tools.

32

u/XtremeGoose f'I only use Py {sys.version[:3]}' Oct 05 '16

Python 2.

I don't think this is very useful to be honest.

7

u/Dumbaz Oct 05 '16

According to the comment section, last time something changed on that website was in late 2014. Out of date.

3

u/DaveChild Oct 05 '16

Yup, it's my cheat sheet and badly needs updating. I really should do a Python 3 one but there are already a lot of good ones.

1

u/_FreeThinker Oct 06 '16

can you point me to one for Python 3 please?

3

u/LovecraftInDC Oct 06 '16

https://perso.limsi.fr/pointal/_media/python:cours:mementopython3-english.pdf

That one seems solid, but honestly my cheat sheet is generally 'my problem/error message' in google.

1

u/PaulSandwich Oct 05 '16

Any good leads on a Python 3 cheatsheet? Coincidentally, I went digging for one last week for a Django project and the results were flooded with version 2.

4

u/[deleted] Oct 05 '16

Stackoverflow.

2

u/PaulSandwich Oct 05 '16

They close the topic pretty quickly over at S.O. as being outside their format. The answers that slip through (at least for the first page of results) are, like I said, for python 2 or just links to the documentation.

2

u/[deleted] Oct 06 '16

Honestly, I'm not really sure how much of a help a cheatsheet for something like a programming language is. When I don't know or can't remember something S.O., the Official Python Docs or a blog found through google is usually where I find an answer. If you're looking for something specific to Py3 then make sure to put that in your Google Search: e.g. 'Python 3 list slicing'.

While 2 and 3 aren't binary compatible, I've personally found the most 2 code will work with a bit of fiddling.

(hope all this isn't too obvious)

1

u/LovecraftInDC Oct 06 '16

I just came to 3 after having very limited experience with 2 a few years ago. Google solved almost all of my issues, though.

1

u/PaulSandwich Oct 10 '16

Funny; if I think about it I've barely used any of the cheatsheets I've found for other projects. They're most useful for introducing me to other functions in the family of ones I'm already familiar with and giving me a head-start on what to google or where to look in the docs.

2

u/DaveChild Oct 05 '16

There's a lot more on Cheatography and I add links to new ones when I find them. If you do find any more, please let me know or add them to the site.

6

u/DaveChild Oct 05 '16

Thanks, that's my cheat sheet! It's a bit old now :)

2

u/maciej01 Oct 07 '16

I have it hanged close to my desk since a few years, thanks for it :)

5

u/BondDotCom Oct 05 '16

Why make it two pages but then only use 1/3 of the second page? Either condense it to one or find more use for page 2.

2

u/DaveChild Oct 05 '16

The PDF generation is automated, and won't sacrifice readability to get the thing on to one page.

2

u/TheTerrasque Oct 05 '16

http://rgruet.free.fr/ is my old classic, but it's py2 only

2

u/CompTIA_SME Oct 05 '16

Thank you.

1

u/SourceSlayer_ Oct 05 '16

This isn't particularly helpful, you'd either already know this or have to look into it.

1

u/[deleted] Oct 05 '16

Will still have to stackoverflow the command to double check.

1

u/Airith Oct 06 '16

This (and some googling as it didn't really explain anything) finally made me figure out slices. Pretty straightforward now, but it seemed very arcane. a[start:end] (optional :step).

0

u/[deleted] Oct 05 '16

[deleted]

13

u/2pxl Oct 05 '16

More like Python Shit Sheet

1

u/DaveChild Oct 24 '16

Is it ironic that my old, out of date, no-longer-maintained cheat sheet is being mocked by someone called "svn"? I think maybe it is ...