Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overload [] operators for getting and setting selected inputs #68

Merged
merged 11 commits into from
Jul 14, 2022

Conversation

Aecrionx
Copy link
Contributor

Hello LovetheFrogs, you have a cool project so I thought I could add some extra features like overloading the [] operator so there's no need to type the whole .get_input() / .set_input() methods. I have also added a section to the remove_input() method so it is possible to delete an input given an index number.

I have also changed the testing files for logic gates to be different asserts statements because I thought it would be easier to go to the line where the error is directly. Instead of finding the string that belongs to an if-statement now it's possible to go directly to the line causing the problem.

If you like/agree with these changes feel free to accept the pull request.

Copy link
Owner

@LovetheFrogs LovetheFrogs left a comment

Choose a reason for hiding this comment

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

Hi! I appreciate your PR, as I'm fairly new with OO Python and I did not think about getitem and setItem. However, I did the tests that way as they were easier for me to read and execute, tho I assume it depends on each own personal liking. I'll wait for your opinion on that for the merge of the branch. Thanks for your contribution!

@Aecrionx
Copy link
Contributor Author

I separated the tests into different assert statements because when the interpreter catches the error it tells you exactly which case (or line) is causing the problem. When you have a project that has hundreds of tests this might save you some time, I think.

@LovetheFrogs
Copy link
Owner

okay it seems reasonable when doing a bunch of tests of some module. I will be doing that for sure for some modules i have in mind. I'm accepting your PR, thanks for all!

@LovetheFrogs LovetheFrogs merged commit 6b4f87d into LovetheFrogs:main Jul 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants