El miércoles, 27 de agosto de 2014 11:40:39 UTC-5, Philip Thomas escribió:
>
>
> I'm a little confused by the Dict() documentation because it does not seem 
> to cover pushing items to a dict. 
>
>
Indeed, the definition of `push!` in dict.jl is just

push!(t::Associative, key, v) = setindex!(t, v, key)
as found using

methods(push!)

 

> 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!
>


 

Reply via email to