Live data from Hacker News

Python Cheatsheet

gto76.github.io

11–20 of 43 posts

Re: Python Cheatsheet

#11
My initial comments:

• Does not cover the “raise from” syntax¹.

• Does not cover Structural Pattern Matching (the “match” and “case” keywords)². (EDIT: The FAQ states that it covers Python 3.8, and this feature was added in Python 3.10.)

• In my basic script template I have this, to show warnings by default:

  if not sys.warnoptions:
      import warnings
      warnings.simplefilter("default")
• My basic script template also uses the “-bbI” switches to python on the shebang line.

1. https://docs.python.org/3/reference/simple_stmts.html#the-ra...>

2. https://docs.python.org/3/reference/compound_stmts.html#the-...>

Re: Python Cheatsheet

#13
post #7

That is a lot of data for a single page IMO. You already have a TOC, several library sections might be pages unto themselves. You might also cross link topics into their relevant python docs for deeper references. I know I always need to dig deeper into CSV/argparse for specific things when working with those systems. Edit: awesome content

> That is a lot of data for a single page IMO.

It is great for a cheat sheet to be on a single page. It makes ctrl+f searching useful and quick.

Re: Python Cheatsheet

#15
post #8
post #3

who exactly is this aimed at? why would they not use the python on-line documentation?

"Unofficial" documentation can serve needs that are neglected by the official docs, even if only by offering a different point of view. I can't speak to Python specifically, but to make an analogy, a microcontroller that I'm working with right now is documented by a 3500 page manual that requires a fair amount of expertise just to know what to look for. But a seasoned embedded dev might be just fine with that, and an…

> In the case of Python, the official docs are typically the last place where I'd look for stuff, given the quality of documents such as this cheat sheet.

you say "I can't speak to Python specifically", but i can assure you that the official docs are far superior to this cheat sheet.

Re: Python Cheatsheet

#16
post #3

who exactly is this aimed at? why would they not use the python on-line documentation?

Discoverability, a document like this makes it much easier to find features and tools you were unaware of. The Python documentation is awesome, but it doesn't provide a 30k ft overview of the language and standard library, especially when the standard lib is so comprehensive.

i really don't see how - i have never had had any difficulty searching for features in the standard library documentation.

Re: Python Cheatsheet

#17

This content has been deprecated by chatgpt. In fact, this could have been generated by chatgpt.

I tried that already, here is the result: https://gist.github.com/gto76/145776c5eace059b09ca1d6ca771a1...

Nice! Looks reasonably comparable at a glance for the collections section.

Re: Python Cheatsheet

#18

Earlier quoted context omitted.

I tried that already, here is the result: https://gist.github.com/gto76/145776c5eace059b09ca1d6ca771a1...

Nice! Looks reasonably comparable at a glance for the collections section.

Sure, but I strongly suspect that it was a part of the corpus (it's been online for ~5 years now).

Re: Python Cheatsheet

#19

Earlier quoted context omitted.

Nice! Looks reasonably comparable at a glance for the collections section.

Sure, but I strongly suspect that it was a part of the corpus (it's been online for ~5 years now).

I asked it to generate something similar for golang with a snippet of the list section, and the results look pretty similar. So I don't think it's relying too heavily on a direct example.
Post reply on HN