Skip to content

How to properly check if a variable is PolyLike? #496

Answered by mhostetter
iyanmv asked this question in Q&A
Discussion options

You must be logged in to vote

I have a private constructor that converts PolyLike into Poly. I found it useful in the internal library code. At one point I considered making it a public constructor. I also toyed with the idea of making galois.Poly() accept PolyLike.

What are you thoughts? Is this what you're looking for? By the way, the type checking if very rudimentary. I've been looking for an easier way to runtime type check using type annotations, but every solution I've found has been shoddy.

def _PolyLike(cls, poly_like: PolyLike, field: Type[Array] | None = None) -> Self:
"""
A private alternate constructor that converts a poly…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@iyanmv
Comment options

@mhostetter
Comment options

Answer selected by iyanmv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants