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

Don't define different classes for each character #3

Merged
merged 1 commit into from
Dec 4, 2021

Conversation

ItsDrike
Copy link
Contributor

@ItsDrike ItsDrike commented Dec 4, 2021

Currently, in the chars.py, you define custom classes for each special character. This is very weird behavior as it defies the purpose of classes in the first place. Each class should be a template and it is expected to be instantiated multiple times making different objects based on that blueprint. Making class singletons like these should generally be discouraged.

I've also removed the RegexChar class as a whole, since it was basically doing the same thing as RegexPattern except it was only supposed to contain one character (which wasn't actually enforced by the class).

- All custom characters were defined with their own individual classes
  which were used as singletons and were never meant to hold anything
  other than that specific value. Using classes for something like this
  doesn't make any sense as we can simply use instances
- This also removes the RegexChar class since it's the same as
  `RegexPattern` class.
@GrandMoff100
Copy link
Owner

Thanks!

That makes sense.
I'll review it real quick.

Copy link
Owner

@GrandMoff100 GrandMoff100 left a comment

Choose a reason for hiding this comment

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

Very efficient!

@GrandMoff100 GrandMoff100 merged commit c806206 into GrandMoff100:master Dec 4, 2021
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.

None yet

2 participants