A 'Python like' language

Gerrit gerrit at nl.linux.org
Tue Mar 30 07:55:35 EST 2004


Mark Hahn wrote:
> > --Take advantage of iterators early on for return values to avoid
> > things like having both dict.items() and dict.iteritems().
> 
> Interestiong idea.  Generators are fully supported so I could do this now.
> So gens would have to be allowed absolutely everywhere lists are allowed (is
> trhis possible?).  Or are you thinking the user should type
> List(dict.items()) ?

If it would be a list, yes, or maybe even dict.items().aslist() or
similar. This because it is quite random for keys to be a list: it could
be a set. This has the advantage that one can do as in Ruby:
myobj.methods() - parent.methods(). But I'm not sure whether parent.methods()
is applicable to a prototype-based language.

> > --Functions that return multiple, but unique, values should return a
> > set, not a list, to communicate same (ex: dict.keys(), dir(), etc.).
> 
> Also cool.

It also applies to dict.items(). This could be either a generator or a
Set. 

> > --Dict should inherit from Set.
> 
> Also cool (I feel like the credits of Holy Grail saying Also wik).

I have read (in c.l.py) that in Smalltalk, a Dict is a Set of Associates
or something similar. I don't know Smalltalk, but I like this idea of a
Set.

Gerrit.

-- 
Weather in Twenthe, Netherlands 30/03 13:25 UTC:
	15.0°C   wind 5.4 m/s E (57 m above NAP)
-- 
here will soon be Gerrit Holl's very own signature




More information about the Python-list mailing list