POV-Ray : Newsgroups : povray.off-topic : Innovative open source? : Re: Innovative open source? Server Time
9 Oct 2024 12:17:28 EDT (-0400)
  Re: Innovative open source?  
From: Nicolas Alvarez
Date: 5 Apr 2009 00:18:10
Message: <49d83101@news.povray.org>
Kevin Wampler wrote:
> Interesting.  So, to make sure I understand correctly if dicts in python
> were to operate like this then:
> 
> D = dict()
> d["a"] = "foo"
> d["b"] = "bar"
> d["c"] = "baz"
> 
> would give me {"a":"foo", "b":"bar", "c":"baz"} where the order matters
>   so D[1] gives "bar"?

No, because key 1 isn't set to any value. However, if you iterate over the
array, you'll get items a, b, c, in that order.

> If so, then what happens in the following case:
> 
> D = dict()
> d[3] = "foo"
> d[2] = "bar"
> d[1] = "baz"

Then d[3] is "foo", but if you iterate, it will be the first item to show
up.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.