Skip to content

fix: fixed the len magic method. - #3

Merged
JonoYang merged 2 commits into
aboutcode-org:mainfrom
35C4n0r:dev
Aug 3, 2023
Merged

fix: fixed the len magic method.#3
JonoYang merged 2 commits into
aboutcode-org:mainfrom
35C4n0r:dev

Conversation

@35C4n0r

@35C4n0r 35C4n0r commented Jul 29, 2023

Copy link
Copy Markdown
Collaborator

Minor updates.

  • Added magic method to perform bitwise or.
  • Fixed the logic to return bitset length.

- Added magic method to perform bitwise or.
- Fixed the logic to return bitset length.

Signed-off-by: 35C4n0r <jaykumar20march@gmail.com>

@JonoYang JonoYang left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@35C4n0r Code looks good. I'd like for you to add a test for the magic methods you implemented.

Comment thread src/bitcode/bitcode.py Outdated
bitset = self.bitset
size = 0
while bitset != 0:
print(bitset)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
print(bitset)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think this should be printed in this method?

Comment thread src/bitcode/bitcode.py
new.bitset = self.bitset & other.bitset
return new

def __or__(self, other):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it would be good to have a test for this, like you do for len().

Comment thread src/bitcode/bitcode.py
ans += "])"
return ans

def __getitem__(self, item):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It would be good to have a test for this too

Signed-off-by: 35C4n0r <jaykumar20march@gmail.com>
@JonoYang

JonoYang commented Aug 3, 2023

Copy link
Copy Markdown
Member

@35C4n0r LGTM!

@JonoYang
JonoYang merged commit 3304808 into aboutcode-org:main Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants