syntax difference

Bart bc at freeuk.com
Tue Jun 26 07:30:05 EDT 2018


On 19/06/2018 11:33, Steven D'Aprano wrote:
> On Tue, 19 Jun 2018 10:19:15 +0100, Bart wrote:

> * Integer sets (Pascal-like sets)
> 
> Why do you need them if you have real sets?

I tried Python sets for the first time. They seemed workable but rather 
clunky to set up. But here is one problem on my CPython:

    x = set(range(10_000_000))

This used up 460MB of RAM (the original 100M I tried exhausted the memory).

The advantage of Pascal-style sets is that that same set will occupy 
only 1.25MB, as it is a bit-map.

While sets will not usually be that big, there might be lots of small 
sets and they all add up.

> Assuming that people who aren't you can even get it to compile. When I
> tried, it wouldn't compile on my computer.

(It won't any more, as there is no C version. I've had it with that 
language.)

-- 
bart



More information about the Python-list mailing list