push! does work on Sets, which are also unordered. Kevin
On Wednesday, August 27, 2014, John Myles White <[email protected]> wrote: > Hi Phillip, > > Could you provide a more complete example of what you're doing? In > particular, I'm very confused by the idea of "pushing" items to a dict, > which is an unordered data structure. > > Here is how dictionaries work in Julia: > > d = Dict() > d["foo"] = "bar" > sizehint(d, 100) > d["bar"] = "foo" > > -- John > > On Aug 27, 2014, at 9:40 AM, Philip Thomas <[email protected] > <javascript:;>> wrote: > > > > > I'm a little confused by the Dict() documentation because it does not > seem to cover pushing items to a dict. > > > > How would I initialize a dict of size n using sizehint then push > key/value pairs to it? > > > > The pythonic syntax of syntax of dict["foo"] = "bar" seems to throw an > exception, and push!() doesn't make pushing key/value pairs clear. > > > > Dict documentation: > > http://julia.readthedocs.org/en/latest/stdlib/base/#Base.Dict > > > > Thanks! > >
