Skip to content

Conversation

@kiranandcode
Copy link
Contributor

This PR updates the Encodable class

class Encodable[T, U]:
  ...
  @classmethod
  def encode(cls, vl: T, env: Mapping[str, Any]) -> U: ...

  @classmethod
  def decode(cls, vl: U, env: Mapping[str, Any]) -> T: ...

@datvo06
Copy link
Contributor

datvo06 commented Jan 21, 2026

Based on our discussion yesterday, would it make sense to have another operation to retrieve context instead? Like in #456 ?

@eb8680
Copy link
Contributor

eb8680 commented Jan 21, 2026

would it make sense to have another operation to retrieve context instead?

I'm not sure I see a use case for this. What are the circumstances where would we need the context but not have access to it as a lexical variable?

Copy link
Contributor

@eb8680 eb8680 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make the argument optional (env: Mapping[str, Any] | None = None), since a lot of the time it's not necessary.

@datvo06
Copy link
Contributor

datvo06 commented Jan 22, 2026

Oh, I see, understood! I will adjust #456 accordingly

@kiranandcode
Copy link
Contributor Author

ok, gotcha, will update!

@eb8680 eb8680 merged commit e12d4a1 into master Jan 22, 2026
6 checks passed
@eb8680 eb8680 deleted the kg-encoding-context branch January 22, 2026 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Encodable should take optional context arguments in encode and decode

3 participants