Re: Big last minute change to 1.0
"Mark Hahn" <[email protected]> Sun, 18 Jul 2004 12:26:11 -0700
| Newsgroups | gmane.comp.lang.prothon.user |
|---|---|
| Message-ID | <00ba01c46cfd$15787cc0$0d01a8c0@MarkVaio> |
Brian Quinlan wrote:
> You mean that the first element addition operation would cause the
> type to crystalize into either a set or a dict and then that type
> would be fixed for the lifetime of the object, right?
>
> Even then it feels a bit skanky. What was your rational for not using
> {} for empty dictionaries and {-} for empty sets?
It doesn't feel skanky if you think of a dictionary as a set of tuples with
each tuple a key/value pair.
I'm in the process of making that analogy literal. I'm trying to figure out
how to make a dictionary an extension of a set so that all the set methods
work on dictionaries. If I succeed, a lot of Dict methods will dissapear
and be replaced by the Set methods it inherits.
I always wondered why Python chose "for x in dict" to return keys instead of
tuples. I originally implemented Prothon to return tuples and had to "fix"
it later to make it Python compatible. If I make Dict an extension of a
Set, then the "in" behavior will be inherited and it will return a tuple
again.
P.S. I also hate {-}