Python Cheatsheet
31–40 of 43 posts
Re: Python Cheatsheet
#32This is great, thanks Jure. For whatever reason I find it difficult to read documentation, I work much better with code examples, they speak to me much more clearly than a text explanation.
Re: Python Cheatsheet
#33Re: Python Cheatsheet
#34Earlier quoted context omitted.
> 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.
At what point does something move from being a cheat-sheet to being a reference manual/training document? I don't have a hard definition other than the "you know it when you see it" and this cross that threshold for me. A cheat-sheet I really like is https://devhints.io/bash which I feel has just enough info (for me) when jumping back into bash from other work to give me proper context.
I have nothing against references or this website as a reference those are useful as well. There is a value in having a good reference which strikes a balance of being exhaustive while avoiding the trap of unreadable verbosity that specifications and standards often have.
Re: Python Cheatsheet
#35Earlier quoted context omitted.
This comment got me thinking “What do you notice that is incorrect or important but missing from this page?” I discovered two things: 1) I’m too shallow in Python to identify any such issues and 2) while GPT-4 and Sage struggled with that precise question, in about 3 seconds I got what appears to be a really useful critique from Claude 2 100k. I’ll share that in case anybody is interested: ___ Here are a few things I…
Eh. I think that critique misses more than it hits. > The dictionary section is missing explanation of dict comprehensions. Dict comprehensions are an important and useful feature for constructing dictionaries in a concise way. Those are in the inline section, with the other comprehensions: https://gto76.github.io/python-cheatsheet/#inline > In the sections on concurrency and parallelism, async/await could be explain…
Re: Python Cheatsheet
#36> Inside Function Call
> Splat expands a collection into positional arguments, while splatty-splat expands a dictionary into keyword arguments.
args = (1, 2)
kwargs = {'x': 3, 'y': 4, 'z': 5}
func(*args, **kwargs)Re: Python Cheatsheet
#37I really like those names, 'splat operator' and 'splatty-splat operator.' > Inside Function Call > Splat expands a collection into positional arguments, while splatty-splat expands a dictionary into keyword arguments. args = (1, 2) kwargs = {'x': 3, 'y': 4, 'z': 5} func(*args, **kwargs)
Re: Python Cheatsheet
#38Re: Python Cheatsheet
#39Earlier quoted context omitted.
"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
#401. Use of notation for almost everything. It might be technically sound, but it brings to mind reading Backus-Naur form specs.
For cheat sheets my_int, my_iterator etc format is more pleasant for eyes.
2. Examples from various external libraries are of questionable real life utility, they are a nice showcase of what is possible, but are really too terse at times - looking at you popcorn audio example.
Official docs for libraries such as Plotly or Pandas are much more pleasant. Then again Copilot is even faster for looking up a tricky matplotlib incantation...
Thus the cheat sheet should have been split in two parts, one would cover Python and possibly standard library.
Second part would cover the popular libraries.