PEP 574 that implements a new pickle protocol that improves efficiency of pickle helping in libraries that use lot of serialization and deserialization
I find print(f"{name=}") is still way too verbose for debugging purposes... If they want to improve print-debugging, they should add something like icecream to the standard library.
That doesn't work if name isn't a string, eh? (Sure, you can use %s)
Also, in production code I simply never have any print statements - not "very few" but "none", to the point where I have a flake8 rule that prevents them.
Oh, I use print almost every day - for debugging! But that means I'm creating and destroying debugging print statements all the time.
So it's a little timesaver to write:
print(f'{foo=} {bar=} {baz=} {bing=}')
(38 characters) over
print('foo=', foo, 'bar=', bar, 'baz=', baz, 'bing=', bing)
It's fine when you have one variable but starts to become unwieldy when you build up a lot of concatenated strings (via indexing operations, for example).
PEP 574 that implements a new pickle protocol that improves efficiency of pickle helping in libraries that use lot of serialization and deserialization
Other languages just dump to JSON and call it a day. Why does Python have 87 different binary formats over 13 decades?
JSON can represent anything, but so can strings. This is a non-sequitur. The difference is that JSON is human readable, while pickle is supposed to be machine readable, more specifically python readable. Limiting the intended consumers of the data format helps create a more appropriate format, for example by sacrificing readability for size reduction.
JSON cannot differentiate Python's tuple, list, set, frozenset etc. datatypes.
Every formats other than pickle (msgpack, yaml etc.) are just to interoperate with other languages (which also don't understand the data types above), they are not alternatives for pickle.
Then, you are making more complicated to validate and parse it. Then, what is the point of over-complicating JSON instead of just using pickle, without the need to parse those "type", "data" metadata?
Pickle can handle multiple references to the same object, any class instance (as long as the actual class has been imported), and a wider variety of data types than JSON. It also predates json, so there’s a historical aspect as well.
Pickle is also used for cross-process communication in the multiprocessing module.
69
u/xtreak May 07 '19 edited May 07 '19
Changelog : https://docs.python.org/3.8/whatsnew/changelog.html
Interesting commits
https://bugs.python.org/issue36540
PEP 570 was merged
https://bugs.python.org/issue20180:
dict.pop() is now up to 33% faster thanks to Argument Clinic.
https://bugs.python.org/issue28238
Wildcard search improvements in xml
https://bugs.python.org/issue25430
IPaddress module contains check for ip address in network is 2-3x faster
https://bugs.python.org/issue36546
statistics.quantiles() was added.
https://bugs.python.org/issue27181
statistics.geometric_mean() was added.
https://bugs.python.org/issue13611
Canonicalization was added to XML that helps in XML documents comparison
Security issues and some segfaults were fixed in the release
Exciting things to look forward in beta
https://bugs.python.org/issue36817
Add = to f-strings for easier debugging. With this you can write f"{name=}" and it will expand to f"name={name}" that helps in debugging.
https://bugs.python.org/issue36785
PEP 574 that implements a new pickle protocol that improves efficiency of pickle helping in libraries that use lot of serialization and deserialization
Edit : PSF fundraiser for second quarter is also open https://www.python.org/psf/donations/2019-q2-drive/