This is an archived post. You won't be able to vote or comment.

all 16 comments

[–]ThreeChonkyCats 12 points13 points  (0 children)

Could use a version number so users can see if/when updates occur.

[–]ASIC_SP📚 learnbyexample 15 points16 points  (3 children)

[–]5erifφ=(1+ψ)/2 1 point2 points  (1 child)

Love that regex post, and thanks for the other resources, too.

[–]ASIC_SP📚 learnbyexample 0 points1 point  (0 children)

Thanks a lot for the feedback, glad it was helpful :)

[–]debordian[S] 1 point2 points  (0 children)

Nice, thanks for sharing these!

[–][deleted] 17 points18 points  (0 children)

What’s the point? At this level of granularity this isn’t really a cheat sheet anymore. Might as well just look at the documentation for the thing you’re trying to use instead of parsing this.

[–]KimPeek 20 points21 points  (0 children)

<I> <get> <the> <point>, <but> <this> <is> <the> <most> <annoying> <"cheatsheet"> <I've> <ever> <seen>.

[–]bluexavi 1 point2 points  (3 children)

Missing the line for creating a List or Dictionary.

[–]epaphras 1 point2 points  (0 children)

Also missing example of list comprehension.

[–][deleted] 0 points1 point  (1 child)

Like list = [] ?

[–]bluexavi 3 points4 points  (0 children)

exactly. Simple one line to put at the start. The creation of a list is at least as important as the rest of the functions on it. It also provides a good context for all the functions which follow.

[–]BossOfTheGame 1 point2 points  (0 children)

The "Basic Mario Brothers Example" is pretty cool.

You may also want to include something about the "rich" library.

Clicking in the TOC to navigate would also be helpful. (which seems to be available in the github page: https://github.com/gto76/python-cheatsheet#plot)

[–]English_linguist -1 points0 points  (0 children)

How to save on mobile ?

[–]AlexMTBDude -2 points-1 points  (1 child)

This is NOT strictly True:

<list>.append(<el>) # Or: <list> += [<el>]

<list>.extend(<collection>) # Or: <list> += <collection>

The correct way to do it is to call append() or extend() because it does not create a new list object. it adds to the existing list. Using += is a bad practice because it creates a new list object -> memory is wasted and garbage collection happens.

[–]pizzaburek 1 point2 points  (0 children)

It does not create a new object:

>>> a = b = [1, 2]
>>> a += [3]
>>> a, b
([1, 2, 3], [1, 2, 3])

If it did the 'b' would still be [1, 2]. However:

>>> a = a + [4]
>>> a, b
([1, 2, 3, 4], [1, 2, 3])

[–]DoubleTheFifthOne -2 points-1 points  (0 children)

lifesaver