PEP 218 Re: ANN: set-0.1 module available

Roman Suzi rnd at onego.ru
Thu May 16 13:46:59 EDT 2002


On Thu, 16 May 2002, Denis S. Otkidach wrote:

>On Thu, 16 May 2002, Roman Suzi wrote:
>
>RS> >It's listed as deferred (and its not mentioned in Guido's
>RS> PEP
>RS> >parade).
>RS> >Maybe it needs a new champion?
>RS>
>RS> Hmmm... What do you mean? Set functionality is being asked
>RS> every day
>RS> (for example, sorted list vs. dictionary thread).
>RS> Implementation
>RS> (as I understand) is there. Why does Guido have any
>RS> objections?
>
>There are still unresolved issues.  

>E.g. should set object be hashable?

Yes, I know this discussion. Math is dealing with
abstract objects while programming language is a model,
which must take efficiency vs. flexibility into account.

In Pascal set type was implemented for limited types of elements
(IIRC) and thus lacked flexibility. It's not Pythonic way.
So, probably Python will implement more flexible, universal sets?
(for example, using hashes when possible or falling back to
other schemes when impossible).

But in the current state of affairs lists and dicts are used to implenet
sets, which is probably not always nice.

>Somebody wish sets of sets or set as dict key that
>require set to be hashable.  Solution in kjSet is certanly bad,
>look at the example below:
>
># s is set and d is dictionary
>if d.has_key(s):
>    # do smth.
>else:
>    # modify s -- this will raise exception


>Here s _is not_ in dictionary but nevertheless is frozen. This
>will confuse users that know nothing about set _implementation_.
>Taking into account that very most users don't know about hashing
>at all, such implementation is suitable only for third party
>modules but not for Python builtin type.

While object identity holds, its the same object.

Sincerely yours, Roman Suzi
-- 
\_ Russia \_ Karelia \_ Petrozavodsk \_ rnd at onego.ru \_
\_ Thursday, May 16, 2002 \_ Powered by Linux RedHat 7.2 \_
\_ "Can't learn to do something well? Learn to enjoy doing it badly!" \_






More information about the Python-list mailing list