Skip to content

How to extend Type or how to type a wrapper class #886

Answered by sobolevn
patrick91 asked this question in Q&A
Discussion options

You must be logged in to vote

The user using the class doesn't really need to know that it has been "enhanced", as it should work as it was before.

I don't undestand this one.

In your current example X and EnhanceX are two very different things:

class X:
    class_prop = 1

EnhanceX = enhance(X)

1, X is a type, EnhanceX is an instance
2. any (potential) X.class_prop calls won't work

I can't find similarities between them. Can you please provide more details?

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@patrick91
Comment options

@sobolevn
Comment options

@patrick91
Comment options

@sobolevn
Comment options

Answer selected by patrick91
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