Stream: helpdesk (published)

Topic: ✔ List local variables


view this post on Zulip Lilith Hafner (Feb 05 2024 at 22:41):

In Python, locals() gives a dictionary containing all local variables. Is there an equivalent in Julia?

view this post on Zulip jar (Feb 05 2024 at 22:44):

julia> function foo()
       x = 1
       Base.@locals
       end
foo (generic function with 1 method)

julia> foo()
Dict{Symbol, Any} with 1 entry:
  :x => 1

view this post on Zulip Notification Bot (Feb 05 2024 at 23:34):

Lilith Hafner has marked this topic as resolved.

view this post on Zulip Lilith Hafner (Feb 05 2024 at 23:34):

Thank you!


Last updated: Dec 28 2024 at 04:38 UTC