# RFC – ergonomic juliacall syntax for passing Python variables to Julia

**URL:** <https://discourse.julialang.org/t/rfc-ergonomic-juliacall-syntax-for-passing-python-variables-to-julia/124266>\
**Category:** General Usage\
**Tags:** question, package, python, pythoncall\
**Created:** [December 30, 2024, 2:25am UTC](https://discourse.julialang.org/t/rfc-ergonomic-juliacall-syntax-for-passing-python-variables-to-julia/124266 "2024-12-30T02:25:03Z")\
**Posts on this page:** 1\
**Showing post:** 19

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [December 30, 2024, 3:12pm UTC](https://discourse.julialang.org/t/rfc-ergonomic-juliacall-syntax-for-passing-python-variables-to-julia/124266/19 "2024-12-30T15:12:47Z")

</div>

> [@MilesCranmer](#):
>
> it lets users automatically use Python objects directly in Julia functions, like in this [covariance matrix example](https://github.com/MilesCranmer/PySR/discussions/792#discussioncomment-11688242) where they just reference a numpy array

The Julia code is defining a function in that example, so why not just make `INV_COV_MATRIX` a parameter of your Julia function? Using globals to pass data to functions is an anti-pattern.

(Even if you then want to pass the function to another function that doesn’t expect the extra parameter, that’s what closures are for, e.g. you pass `lambda tree, dataset, options: custom_loss(tree, dataset, options, inv_cov)`.)

---

_[View the full topic](https://discourse.julialang.org/t/rfc-ergonomic-juliacall-syntax-for-passing-python-variables-to-julia/124266)._
