Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

hydrojson

Slide 3

Slide 3 text

EXPECTATION... REALITY...

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

"Hey, I wrote a JSON encoder!"

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

https://www.cartoonstock.com/cartoonview.asp?catref=rdin355

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

http://seriot.ch/parsing_json.php

Slide 10

Slide 10 text

https://bugs.python.org/issue21529

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

Parsing JSON - Hieronymus Bosch, 1501

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

------------------------------------------------------------------------------- Language files blank comment code ------------------------------------------------------------------------------- JSON 3 0 0 1087568 Python 15 404 148 1331 Rust 2 63 65 468 Markdown 1 46 0 107 Bourne Shell 4 17 7 54 make 1 9 0 32 YAML 1 6 2 23 TOML 1 5 0 20 ------------------------------------------------------------------------------- SUM: 28 550 222 1089603 -------------------------------------------------------------------------------

Slide 21

Slide 21 text

>>> import lenrs >>> len("hello") 5 >>> len(["this", "is", "a", "test"]) 4 >>> len(1) Traceback (most recent call last): File "", line 1, in TypeError: object of type 'int' has no len()

Slide 22

Slide 22 text

#![feature(proc_macro)] #![feature(proc_macro_path_invoc)] extern crate pyo3; use pyo3::prelude::*; #[py::modinit(_lenrs)] fn init(py: Python, m: &PyModule) -> PyResult<()> { #[pyfn(m, "len")] fn len(py: Python, obj: PyObject) -> PyResult { if let Ok(s) = obj.extract::(py) { return Ok(s.len().to_object(py)); } if let Ok(v) = obj.extract::>(py) { return Ok(v.len().to_object(py)); } Err(PyErr::new::("Not supported")) } Ok(()) } Requires nightly Rust Module name in Python Function name in Python

Slide 23

Slide 23 text

Write your own Python Extension in Rust!
 
 https://www.youtube.com/watch?v=D9r__qxtRMQ

Slide 24

Slide 24 text

No content