Skip to content

manage etsi magic values #477

@tigroo

Description

@tigroo

Yeah, I don't like all those magic values either; that's indeed ugly... :-(

But I don't really want to introduce constants for each such values either: given each variable may have its own special value to define it is unavailable, that would make for a lot of contants, which would not be much better...

The ETSI.si2etsi() prototype is:

class ETSI:
    def si2etsi(
        value: float | None,
        scale: float,
        undef: Optional[int] = None,
        validity_range: Optional[dict] = None,
        out_of_range: Optional[int] = None,
    ) -> int:

In retrospect, I see two issues there:

  1. the undef parameter should have been named unavailable (or undefined)
  2. the parameters should have been keyword-only, so when called, it would be obvious that the value being passed as undefined (or unavailable) was exactly that: undefined (or unavailable).

So, I would like to address this in a followup change, if that's OK for you?

Originally posted by @ymorin-orange in #459 (comment)

Metadata

Metadata

Assignees

Labels

Projects

Status

Ready

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions