Py2.3: Feedback on Sets

Troels Therkelsen t_therkelsen at hotmail.com
Tue Aug 12 04:56:34 EDT 2003


In article <Jp%Za.256$jw4.238 at nwrdny03.gnilink.net>, Raymond Hettinger wrote:
> I've gotten lots of feedback on the itertools module
> but have not heard a peep about the new sets module.

I would have to say that while I have looked at the sets module and read its
documentation, I have not used it much (more below).

> * Are you overjoyed/outraged by the choice of | and &
>    as set operators (instead of + and *)?

I actually prefer the | & syntax because it makes more intuitive sense to
me, as the operators work identically to how they do when using them as
binary number operators.

[snip]

> * Do you care that sets can only contain hashable elements?

No.

[snip]

> * Are the docs clear?  Can you suggest improvements?

The docs for the sets module, like most of the Python docs, are very good.
The example helps, too.

> * Are sets helpful in your daily work or does the need arise
>    only rarely?

I rarely need sets explicitly, but sometimes need the logic that they offer.
For example, when wanting to concantenate two lists so that the resulting list
only has unique elements, that can be done with set logic.  However, as it
is another module written in Python, and I only need the logic I usually don't
go through with the overhead of creating the Set classes, etc.  If it was
better integrated (ie., a set() builtin type constructor like int(), str(),
etc) then I would feel less of a reservation against using sets.  I know this
reservation isn't founded in facts, but more in the feeling of trusting
builtin types more than custom classes provided by a module.

> User feedback is essential to determining the future direction
> of sets (whether it will be implemented in C, change API,
> and/or be given supporting language syntax).

Don't know if my feedback provided above helps, but you asked for it ;-)

Regards,

Troels Therkelsen




More information about the Python-list mailing list