Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Provide guidance on parameters and variables with the same name

オープン
#12 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
ドキュメント
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
python
領域
documentation

調査の方向性

The issue names no files, tests, or entry points to inspect. Compare the three naming and variable-design examples, then document a decided convention for parameters and variables with the same name, including when the convention is considered complete.

索引モデルが issue の本文から書いたものです。

説明

For example, consider the case of identifying whether a household is in poverty, where poverty line is indexed by household size. The formula could include Python variables that both represent the poverty line parameter (which is indexed by household size) and the household's poverty line based on their specific household size. I see three ways to address this:

A: Add a qualifier to the entity's value, e.g. household_
class is_in_poverty(Variable):
    def formula(household, period, parameters):
        poverty_line = parameters(period).poverty.poverty_line
        household_size = household.nb_persons()
        household_poverty_line = poverty_line[household_size]
        return household("household_income") < household_poverty_line
B: Add a qualifier to the parameter, e.g. param_ or p_
class is_in_poverty(Variable):
    def formula(household, period, parameters):
        param_poverty_line = parameters(period).poverty.poverty_line
        household_size = household.nb_persons()
        poverty_line = poverty_line[household_size]
        return household("household_income") < poverty_line
C: Add a separate OpenFisca variable for any parameter indexed by household features
class household_poverty_line(Variable):
    def formula(household, period, parameters):
        poverty_line = parameters(period).poverty.poverty_line
        household_size = household.nb_persons()
        return poverty_line[household_size]

class is_in_poverty(Variable):
    def formula(household, period, parameters):
        return household("household_income") < household("household_poverty_line")

Option C creates a lot of variables, but it seems cleanest to me. I think it would avoid the issue of potentially overlapping variables to represent parameters and Variables, but there might be some cases I'm not thinking of.

主要言語
Makefile
スター
1
フォーク
3
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

PolicyEngine/policyengine.dev のほかの issue

PolicyEngine/policyengine.dev の issue をすべて見る

似ている issue

Documentation の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。