10 Followers
31 Following
5 Posts
CTO at sei.so, cloud native security nerd
BSidesPGH
Steel City InfoSec
PittSec
HACKS
...

Did you know you can see how #Python parses your code? 🐍🤯

Breaking a .py file into a tree of "tokens" 🪙

python3 -m tokenize hi‍.py

Turning that into an "abstract syntax tree" 🎋

python3 -m ast hi‍.py

Then "disassembling" that to bytecode 🤖

python3 -m dis hi‍.py

When people say "comprehensions generate fewer operations than loops", they used dis.

I used the ast module when I made my undataclass script: https://www.pythonmorsels.com/undataclass/

More in this PyCascades talk: https://m.youtube.com/watch?v=RcGshw0tzoc&feature=youtu.be

Convert dataclass to non-dataclass

Want to see what code you'd need to write to recreate your dataclass without using the dataclass decorator? Try out this dataclass converter.

@hacks4pancakes yeah my brother-in-law gets all his lights from second hand stores and then just throws them out at the end of each year. To each their own

I just try to balance the waste and utility, without needing to spend hours each year testing bulbs to get half of that strand to light back up again

@hacks4pancakes I highly recommend one piece bulbs for the future. The two piece (replaceable) ones don't last more than a couple years IME