Skip to content

Use equality instead of identity check with literal#14

Open
Aloxaf wants to merge 2 commits intothautwarm:masterfrom
Aloxaf:use_equality
Open

Use equality instead of identity check with literal#14
Aloxaf wants to merge 2 commits intothautwarm:masterfrom
Aloxaf:use_equality

Conversation

@Aloxaf
Copy link
Contributor

@Aloxaf Aloxaf commented Nov 17, 2019

fix part of #13 ( don't know how to fix the second error _(:з」∠)_

@thautwarm
Copy link
Owner

Hi, could you remove this as well:

if -5 < get_constant(n) < 256:

If is stuffs get removed they're then useless at all.

Besides, I tried to speed up the program safely with some compile time information, and using is and is not is such a case. However it now comes that is or is not is producing warning though. I'll ask the some core developers about my concerns today, and decide whether to accept your PR recently.

@Aloxaf
Copy link
Contributor Author

Aloxaf commented Nov 17, 2019

That's really magic.

If it is a way to speed up the program, how about disable the warning or tell the user to disable it?

@thautwarm
Copy link
Owner

As we're implementing compilers, It's a valid behaviour.
Also, it's compatible for almost all python implementations(many treat is as a structural equality operator for immutable data)

@thautwarm
Copy link
Owner

If it is a way to speed up the program, how about disable the warning or tell the user to disable it?

I'm working on this, and will remove the optimizations if it's impossible to suppress the warning in a hygienic way.

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