Articles, projects and tutorials about #Python. Weekly newsletter: https://xitter.cf/t.co/yAyJfZX43G

Joined September 2021
Python Weekly 🐍 retweeted
Python Multiprocessing Pool: Complete API Guide superfastpython.com/multipro… Discussions: discu.eu/q/https://superfast… #programming #python by @SuperFastPython
1
2
86
Python Weekly 🐍 retweeted
The 7.1.0 release is out 🎉 Massive shoutout to all the contributors. 🙌 ibis-project.org/release_not… 1/n Highlights: - read_parquet, read_csv, read_json for #BigQuery - Table sampling using t.sample() - @duckdb fsspec support (enabling among other things GCS reads)
1
6
19
4,248
Python Weekly 🐍 retweeted
Director.... Animator....Occasional Nude organist & flower arranger... Happiest of birthdays to our very own Terry Gilliam, who turns 83 today! #HappyBirthday #Birthday #TerryGilliam #FlyingCircus #Director
31
251
13
2,010
61,689
Python Weekly 🐍 retweeted
We are excited to announce that PyCon Italia 2024 is back in Florence from the 22nd to the 25th of May 2024! 🇮🇹 Our website is now up with the upcoming dates for our CFP, Grants, tickets and more! Mark your calendar! buff.ly/3GajwVe 🐍
19
5
49
6,880
Python Weekly 🐍 retweeted
Talk by my coworker (and co core dev) Brandt Bucher on how we plan a JIT for Python 3.13. youtu.be/HxSHIpEQRjs
11
118
12
692
489,500
Python Weekly 🐍 retweeted
Why and How CPython use Bloom Filters inside some of its String APIs, such as splitlines and strip? Let's take a tour of CPython internals to understand the use of bloom filters within CPython's string APIs and to see how it implements the bloom filter. Use of Bloom FIlters in splitlines(): The splitlines() API is used to split a string by lines. Naturally, it needs to scan the string character by character and check if it is a line break character. This would have been straightforward if there was only one way to represent line breaks, e.g. '\n'. However, as it turns out there are 8 different code points in Unicode to represent a new line. Now, doing 8 comparisons for each character when most of them are going to result in a negative answer is expensive. We can't afford this in applications processing large amounts of data. Using a set would be an obvious option but they require hash functions, which can be costly when performed so frequently. Instead, CPython employs a bloom filter to do this. Yes, a bloom filter also requires hash function(s). However, CPython devs have implemented it in a clever manner which circumvents any hash computation whatsoever. Sounds curious, isn't it? If you are interested in learning how they do it, keep reading! Now, using a bloom filter for checking line break characters is fast because for majority of characters the answer is negative. And, if the answer turns out to be positive, CPython does a full comparison against all 8 possible line break chars. The following illustration shows the code. Use of Bloom Filters in strip() API: Similarly, CPython uses bloom filters in the strip API. The strip method removes specified characters from the start, end, or both ends of a string. It takes the list of characters to be removed as a parameter and there is no limit on how many characters you can specify. As the size of the set of characters to be stripped is potentially unbounded, comparing against every member of this set is impractical. Therefore, CPython uses a bloom filter as a first point of check which can quickly return negative. In case it does give a positive result, then CPython needs to do a full comparison. The following listing shows the code for the strip API implementation from CPython code. Bloom Filter Implementation in CPython: Now, coming to how CPython implements bloom filter such that it avoids expensive hash functions? The following listing shows the full C code, which is < 50 lines. I have annotated it to explain what's happening. But the key points are: - It uses an unsigned long value as the bit vector. It gives 64 bits on 64-bit hardware which is sufficient for storing characters of a string - Instead of using expensive hash functions, it uses lower n-bits of the character and sets the corresponding bits on in the bit vector to add the character - On 64 bit hardware, it uses lower 6 bits of each character, whereas on 32 bit hardware it uses lower 5 bits. This was a curtailed version of my latest article. In the article I break down the CPython code explain the bloom filter implementation piece by piece. Check it out (link in the replies).
12
101
10
522
122,014
Python Weekly 🐍 retweeted
Hey, do you know the @ThePSF is hiring for a full-time position called the Deputy CPython Developer in Residence? It's a special role where you'd work with me and the rest of the core team on directly shaping the future of #Python. Want to know more? lukasz.langa.pl/40b601fc-2b2…
48
2
113
37,522
Python Weekly 🐍 retweeted
Here it is: the FastAPI Reference - Code API in the docs. ✨ One of the most awaited requests from many users. 🔥 FastAPI 0.104.0 🔖 fastapi.tiangolo.com/referen…
9
51
6
298
68,094
Python Weekly 🐍 retweeted
Charlie Marsh
@charliermarsh16 Oct 2023
Ruff v0.1.0 is out now. This release is all about stabilization. Given Ruff's rapid growth, we're introducing new features to better reflect Ruff's maturity and make life easier for our users as we continue to iterate. astral.sh/blog/ruff-v0.1.0
8
39
1
285
34,261
Python Weekly 🐍 retweeted
Why not tell people to "simply" use pyenv, poetry or anaconda bitecode.substack.com/p/why-… Discussions: discu.eu/q/https://bitecode.… #programming #python
1
1
113
Python Weekly 🐍 retweeted
1
2
122
Google finds faster sorting algorithm using deep reinforcement learning nature.com/articles/s41586-0… Discussions: discu.eu/q/https://www.natur… #artificial #programming
2
1
128
Python Weekly 🐍 retweeted
How to structure a project that contains C++ and Python code github.com/smrfeld/cmake_cpp… Discussions: discu.eu/q/https://github.co… #cpp #learnpython #programming #python
3
16
681
Python Weekly 🐍 retweeted
ReactPy: Build ReactJS Interfaces in Pure Python github.com/reactive-python/r… Discussions: discu.eu/q/https://github.co… #programming #python by @reactpy
27
85
4,085
Python Weekly 🐍 retweeted
Plan to Have a Python Bindings for My App Written in Go github.com/hkpeaks/peaks-con… Discussions: discu.eu/q/https://github.co… #golang #programming #python
1
1
122