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

More about hidden memory #3

Open
noviluni opened this issue Jan 25, 2019 · 2 comments
Open

More about hidden memory #3

noviluni opened this issue Jan 25, 2019 · 2 comments

Comments

@noviluni
Copy link
Contributor

noviluni commented Jan 25, 2019

That's not a issue with the project but a question for you about a snippet that could be in the README.

I know another case which I think is related with your "hidden memory" snippet, but I can't understand why it happens.

>>> x = 'a'*20
>>> y = 'a'*20
>>> x is y
True

>>> x = 'a'*21
>>> y = 'a'*21
>>> x is y
False

And then, if we create directly a string with more than 20 equals characters:

>>> x = 'aaaaaaaaaaaaaaaaaaaaaaaaa'
>>> y = 'aaaaaaaaaaaaaaaaaaaaaaaaa'
>>> x is y
True

It seems that they are identical.

Do you know why it happens?

Thanks in advance!

@abdulniyaspm
Copy link

abdulniyaspm commented Sep 22, 2020

@noviluni I hope this answer and comment from SO will answer your question.

@noviluni
Copy link
Contributor Author

hey, yeah, really interesting, thanks @abdulniyaspm!

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

No branches or pull requests

2 participants