Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Provide guidance on parameters and variables with the same name

Đang mở
#12 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Tài liệu
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
documentation

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Makefile
Star
1
Fork
3
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của PolicyEngine/policyengine.dev

Tất cả issue của PolicyEngine/policyengine.dev

Issue tương tự

Thêm issue về Documentation

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.