julia UndefVarError: unshift! no definida

Aug 20 2020

Yo uso julia 1.4 y ejecuto el siguiente código:

using PyCall
using JLD
using ArgParse
using Pandas
@pyimport networkx as nx
@pyimport scipy.sparse.csgraph as csg
@pyimport numpy as np

unshift!(PyVector(pyimport("sys")["path"]), "")
# unshift!(PyVector(pyimport("sys")["path"]), "..")
unshift!(PyVector(pyimport("sys")["path"]), "combinatorial")
@pyimport utils.load_graph as lg
@pyimport utils.distortions as dis
@pyimport graph_util as gu
....

cuando ejecuto este código, me sale el siguiente error:

 ERROR: LoadError: UndefVarError: unshift! not defined
Stacktrace:
 [1] top-level scope at /root/hyperbolics/combinatorial/comb.jl:9
 [2] include(::Module, ::String) at ./Base.jl:377
 [3] exec_options(::Base.JLOptions) at ./client.jl:288
 [4] _start() at ./client.jl:484
in expression starting at /root/hyperbolics/combinatorial/comb.jl:9

Cuando busqué documentos, ¡unshift! es una función existente en julia 1.4, por lo que no entiendo por qué ocurre este error. Soy nuevo en julia, por favor ayuda.

Respuestas

6 fredrikekre Aug 19 2020 at 22:55

desarmar! es una función existente en julia 1.4

¿Dónde viste esto? Fue renombrado para Julia 1.0 hace dos años a pushfirst!:

julia> pushfirst!([1, 2, 3], 4)
4-element Array{Int64,1}:
 4
 1
 2
 3