Live data from Hacker News

Show HN: An educational blockchain implementation in Python

github.com

41–44 of 44 posts

Re: Show HN: An educational blockchain implementation in Python

#41
post #40

Earlier quoted context omitted.

For deterministic serialization (~canonicalization), you can use sort_keys=True or serialize OrderedDicts. For deseialization, you'd need object_pairs_hook=collections.OrderedDict. Most current blockchains sign a binary representation with fixed length fields. In terms of JSON, JSON-LD is for graphs and it can be canonicalized. Blockcerts and Chainpoint are JSON-LD specs: > Blockcerts uses the Verifiable Claims Merkl…

FYI, dicts are now ordered by default as of Python 3.6.

That's an implementation detail, and shouldn't be relied upon. If you want an ordered dictionary, you should use collections.OrderedDict.

Re: Show HN: An educational blockchain implementation in Python

#42
post #40

Earlier quoted context omitted.

FYI, dicts are now ordered by default as of Python 3.6.

That's an implementation detail, and shouldn't be relied upon. If you want an ordered dictionary, you should use collections.OrderedDict.

True, but if you need both key ordering and performance, dict is the better option.

Re: Show HN: An educational blockchain implementation in Python

#43
post #40

Earlier quoted context omitted.

FYI, dicts are now ordered by default as of Python 3.6.

That's an implementation detail, and shouldn't be relied upon. If you want an ordered dictionary, you should use collections.OrderedDict.

It's now the spec for 3.6+.

> #python news: @gvanrossum just pronounced that dicts are now guaranteed to retain insertion order. This is the end of a long journey.

https://twitter.com/raymondh/status/941709626545864704

More here: https://www.reddit.com/r/Python/comments/7jyluw/dict_knownor...

OrderedDicts are backwards-compatible and are guaranteed to maintain order after deletion.

Post reply on HN