Skip to content

Derive Status class from int - #8

Merged
mgeier merged 1 commit into
masterfrom
issue-8
May 20, 2015
Merged

mgeier merged 1 commit into
masterfrom
issue-8

Conversation

@mgeier

@mgeier mgeier commented May 17, 2015

Copy link
Copy Markdown
Member

No description provided.

@mgeier

mgeier commented May 17, 2015

Copy link
Copy Markdown
Member Author

Deriving from int isn't a problem, except that this adds some additional attributes to a Status object.
Namely, those are 'bit_length', 'conjugate', 'denominator', 'from_bytes', 'imag', 'numerator', 'real', 'to_bytes'.

This is annoying, because those make it harder to find the attributes we are actually interested in, especially when using tab-completion ...

I didn't find a way to add int behavior without adding the annoying attributes, any suggestions?

According to this stackoverflow question, there doesn't seem to be a (reasonably simple) way to do that ...

@mgeier

mgeier commented May 17, 2015

Copy link
Copy Markdown
Member Author

So I found a solution anyway ... but it's not as nice as I hoped ...

I'm not deriving from int, but most of the operators work with ints.

@mgeier
mgeier merged commit 2e7c292 into master May 20, 2015
@mgeier
mgeier deleted the issue-8 branch May 20, 2015 10:51
@mgeier mgeier added this to the 0.3.0 milestone May 20, 2015
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.

1 participant