Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Identifiers with subscripts and superscripts

未关闭
#484 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
30/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
python
领域
api

调研方向

首先重现 issue 中所示的 PyJulia 调用,并将 Python 关键字规范化与 traceback 中 Julia 侧的名称进行比较。跟踪 PyCall 调用周围的参数处理;当存在传递原始标识符的文档化方式,或存在针对下标和上标的、经过约定且测试过的转换时,即视为完成。

由索引模型根据 Issue 内容生成。

描述

As mentioned in the documention, Python3 normalizes some unicode identifiers, in particular those including subscripts and superscripts.

Now, I have a julia function that needs input arguments written with sub/superscripts. How can I pass the correct identifer to the function ?
Otherwise, in the same way function!() is converted to function_b(), coud we think of converting Rₛ to Rs ?

>>> from julia import PlantBiophysics as PB
>>> leaf = PB.LeafModels(
        energy = PB.Monteith(),
        photosynthesis = PB.Fvcb(),
        stomatal_conductance = PB.Medlyn(0.03, 12.0),
        Rₛ = 13.747, skyFraction = 1.0, PPFD = 1500.0, d = 0.03
    )

┌ Warning: use values(kwargs) and keys(kwargs) instead of kwargs.data and kwargs.itr
│   caller = #MutableNamedTuple#1 at MutableNamedTuples.jl:9 [inlined]
└ @ Core ~/.julia/packages/MutableNamedTuples/6Sa4J/src/MutableNamedTuples.jl:9
┌ Warning: use values(kwargs) and keys(kwargs) instead of kwargs.data and kwargs.itr
│   caller = #MutableNamedTuple#1 at MutableNamedTuples.jl:9 [inlined]
└ @ Core ~/.julia/packages/MutableNamedTuples/6Sa4J/src/MutableNamedTuples.jl:9

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
/var/folders/v1/6y176c8d2jz06qr8rd3jq_480000gn/T/ipykernel_82531/2481116038.py in <module>
----> 1 leaf = PB.LeafModels(
      2         energy = PB.Monteith(),
      3         photosynthesis = PB.Fvcb(),
      4         stomatal_conductance = PB.Medlyn(0.03, 12.0),
      5         Rₛ = 13.747, skyFraction = 1.0, PPFD = 1500.0, d = 0.03

RuntimeError: <PyCall.jlwrap (in a Julia function called from Python)
JULIA: Key Rs not found as a variable of any provided models
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:33
 [2] init_variables_manual(::Missing, ::Vararg{Any}; vars::Base.Pairs{Symbol, Float64, NTuple{4, Symbol}, NamedTuple{(:Rs, :skyFraction, :PPFD, :d), NTuple{4, Float64}}})
   @ PlantBiophysics ~/.julia/packages/PlantBiophysics/BC7Kh/src/models_helpers.jl:320
 [3] PlantBiophysics.LeafModels(; interception::Missing, energy::PlantBiophysics.Monteith{Float64, Int64}, photosynthesis::PlantBiophysics.Fvcb{Float64}, stomatal_conductance::PlantBiophysics.Medlyn{Float64}, status::Base.Pairs{Symbol, Float64, NTuple{4, Symbol}, NamedTuple{(:Rs, :skyFraction, :PPFD, :d), NTuple{4, Float64}}})
   @ PlantBiophysics ~/.julia/packages/PlantBiophysics/BC7Kh/src/structs/concrete_component_structs.jl:110
 [4] invokelatest(::Any; kwargs::Base.Pairs{Symbol, Any, NTuple{7, Symbol}, NamedTuple{(:energy, :photosynthesis, :stomatal_conductance, :Rs, :skyFraction, :PPFD, :d), Tuple{PlantBiophysics.Monteith{Float64, Int64}, PlantBiophysics.Fvcb{Float64}, PlantBiophysics.Medlyn{Float64}, Float64, Float64, Float64, Float64}}})
   @ Base ./essentials.jl:718
 [5] _pyjlwrap_call(f::Type, args_::Ptr{PyCall.PyObject_struct}, kw_::Ptr{PyCall.PyObject_struct})
   @ PyCall ~/.julia/packages/PyCall/L0fLP/src/callback.jl:32
 [6] pyjlwrap_call(self_::Ptr{PyCall.PyObject_struct}, args_::Ptr{PyCall.PyObject_struct}, kw_::Ptr{PyCall.PyObject_struct})
   @ PyCall ~/.julia/packages/PyCall/L0fLP/src/callback.jl:44>
主要语言
Python
星标
893
派生
101
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

JuliaPy/pyjulia 的其他 Issue

查看 JuliaPy/pyjulia 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。