
Best Python Reference Ever - pizzaburek
https://github.com/gto76/python-cheatsheet
======
FZ1
A key hallmark of Python is readability - which this cheat sheet has managed
to royally screw up.

It looks more like an XML cheatsheet at first glance.

I work in python full-time for a living, and found myself having to re-examine
several times to make sense of this wacky, non-standard notation.

\-------

Edit:

Keep in mind there's a standard way to represent these options in a clear,
consistent manner (lists, sequences, optional args).

No need to re-invent something that's hard to read and understand.

See: [https://docs.python.org/3/library/stdtypes.html#sequence-
typ...](https://docs.python.org/3/library/stdtypes.html#sequence-types-list-
tuple-range)

~~~
nixpulvis
the hallmark is readability?! really!?

Please explain to me why then you introduce a binding _after_ you use it in
array comprehensions.

    
    
        [x*2 for x in range(1,10)]

~~~
vharuck
As a person who majored in math, this is very readable.

~~~
nixpulvis
As a person who often struggled in math for perhaps many reasons, this was a
common issue for me.

First you define things, then you use them.

No other rule makes sense generally, and I challenge anyone to prove me wrong.

Now is a simple set like { 2x : x ∈ ℝ } going to confuse me, probably not...
but when variables are just thrown around all willy nilly, I get confused
pretty quick.

------
seemslegit
The <thing> notation is pretty confusing and I find myself using my knowledge
of python to understand what half of the examples are teaching rather than the
other way around.

------
gjm11
Seems like a needlessly editorialized title. (The actual title at the far end
of the link is "Comprehensive Python Cheatsheet".)

------
meowface
Don't think I'd ever use this, but this was new to me:

>To dynamically access function's first free variable use
'<function>.__closure__[0].cell_contents'.

------
strogonoff
A good way of specifying variable types in sample code is with Python’s native
type hint syntax[0].

Using angle brackets is an option, but it results in invalid syntax (confusing
to beginner programmers) and is used by languages such as TypeScript and Swift
to signify generics (confusing to established engineers coming from those
languages).

[0]
[https://docs.python.org/3/library/typing.html](https://docs.python.org/3/library/typing.html)

------
umvi
"Basic Mario Brothers Example"

This needs to be a thing for every programming language cheatsheet

------
siquick
Great resource

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

Not a fan of the += syntax in this instance - seeing _.append_ instantly lets
me know I'm dealing with a list whereas += can be used on almost anything

------
saeranv
I use Python full time and I found this useful. Starred it for future
reference.

Why does everyone find the <thing> notation confusing? <list> means its a
list, and so on. I'm really surprised it's tripping people up.

