0
#1 most entertaining talk at pycon ever
informative and funny presentation at pycon 2016 about bytecode manipulation in python. it's 40 minutes long but useful and informative. https://youtu.be/qr82CLydGkc
2 Réponses
+ 4
In the presentation:
* Debugger injection is a very good point; I definitely needed this once.
* They mention not being able to execute a code object directly. That's because some of the preamble code is missing; I address this with marshal in method 6 (line 141) here:
https://code.sololearn.com/c0laSyLWCgTL/?ref=app
Here's a little more info on bytecodes (as well as built-in opcode info) for a few custom commands built using eval() and exec():
https://code.sololearn.com/cxYMW29npKWp/?ref=app
Finally... What Does It Take To Be An Expert At Python?
https://youtu.be/7lmCu8wz8ro (1h52m - 2x speed ok)
* How "class" and "generator" statements are themselves executable statements (unlike c++, which just generates a memory layout).
This lets you (e.g.) intercept construction of your library class...at the remote end...and enforce construction- or instantiation-time (vs runtime) constraints.
* The presenter -- at length -- shows how Python has very *specific* patterns, and how understanding the mental models lets you wrap / annotate / decorate to assemble powerful, seamless, automatic constructs that just work...on any function... without having to rewrite anyone's code.
* He also shows how you can just figure out the syntax as you go, without ever leaving Python.
0
Thanks, I'll give it a check