an ingrate newbie complains

Gerrit gerrit at nl.linux.org
Wed Feb 4 13:13:57 EST 2004


Batista, Facundo wrote:
> Elaine Jackson wrote:
> 
> #- 1) I find the following behavior puzzling and disappointing:
> #- 
> #- >>> X=[(1,1),(2,4),(3,9),(4,16),(5,25)]
> #- >>> Y=dict(X)
> #- >>> Z=list(Y)
> #- >>> Z==X
> #- False
> #- >>> Z==Y.keys()
> #- True
> 
> >>> Y
> {1: 1, 2: 4, 3: 9, 4: 16, 5: 25}
> >>> Z
> [1, 2, 3, 4, 5]
> 
> I should expect that Z is not equal to Y.

Well, the complain here is dat list(D) == D.keys(), not D.values().
I share that complain.

>>> D
{0: 'foo', 1: 'foo', 2: 'foo', 3: 'foo', 4: 'foo'}
>>> list(D)
[0, 1, 2, 3, 4]

Gerrit.

-- 
PrePEP: Builtin path type
    http://people.nl.linux.org/~gerrit/creaties/path/pep-xxxx.html
Asperger's Syndrome - a personal approach:
	http://people.nl.linux.org/~gerrit/english/




More information about the Python-list mailing list