Live data from Hacker News

Comprehensive Python Cheatsheet (2018)

gto76.github.io

1–10 of 83 posts

Re: Comprehensive Python Cheatsheet (2018)

#5
post #3

Very good page. But the best python cheat sheet is help(the_thing) . python has the second best ever help and discoverability (after Matlab of course!)

Yes! And implementing this help text for your library is free. It just assembles the docstrings found in your code. And then your favourite text editor can use this for autocomplete and such as well.

Treating docstrings as an actual reflectable part of a class/function and not just "comments to be ignored by a parser" is brilliant.

Re: Comprehensive Python Cheatsheet (2018)

#10
post #8

There are several items that are dubious at best. Why would you use no_duplicates = list(dict.fromkeys( )) instead of no_duplicates = list(set( )) ?

>>> list(dict.fromkeys([3, 2, 1])) [3, 2, 1] >>> list(set([3, 2, 1])) [1, 2, 3]

Very cool!
Post reply on HN