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

It seems like one sample in "Section: Strain your brain! --> Strings can be tricky sometimes *" has been not suitable for Python 3.7.1? #120

Closed
RocShi opened this issue Mar 20, 2019 · 5 comments
Milestone

Comments

@RocShi
Copy link

RocShi commented Mar 20, 2019

Hello, thanks for your great effort in wtfpython. In practice, the result of last sample of 2nd code segment in Strings can be tricky sometimes * is different with that of mine. In wtfpython, it's like:

>>> a, b = "wtf!", "wtf!"
>>> a is b
True

But in my development environment, it's like:

$ python3
Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:57:15) [MSC v.1915 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> a, b = "wtf!", "wtf!"
>>> a is b
False

My development environment is as follows.

  • windows 10 Enterprise (64-bit) based on x64 processor

  • Python 3.7.1 (64-bit)

So, is the sample mentioned above not suitable for Python 3.7.1?

@Ricocotam
Copy link

Ricocotam commented Mar 20, 2019

It seems new in Python3.7
I ran these on 3.7.0 and 3.6.6 and got different results.

>>> # 3.7
>>> a, b = "wtf!", "wtf!"
>>> a is b
False
>>> a, b = "wtf", "wtf"
>>> a is b  # Still works
True
>>> # 3.6
>>> a, b = "wtf!", "wtf!"  # or a, b = "wtf", "wtf"
>>> a is b
True

I don't know why there's a change, but there's a problem, for sure :)

Edit : From what I understand, it might be due to one of these two PEPs : 538 & 540

@RocShi
Copy link
Author

RocShi commented Mar 20, 2019

@Ricocotam I have read PEP 538 and PEP 540, maybe you are right.

@Ricocotam
Copy link

I don't know how it would affect this, but it's the only thing I can see from Python 3.7 change logs that could modify the behavior

@satwikkansal
Copy link
Owner

Hey @RocShi thanks for highlighting this. I'm digging in deeper to find out what exactly caused this behavior change, and will update the example in the next release :)

@satwikkansal satwikkansal added this to the 3.0 milestone May 1, 2019
@satwikkansal
Copy link
Owner

This is similar to issue encountered in "is is not what it is" example. So closing this in favor of #100 , let's continue the discussion there :)

satwikkansal added a commit that referenced this issue Jun 9, 2019
satwikkansal added a commit that referenced this issue Oct 28, 2019
muscliary pushed a commit to muscliary/wtfpython that referenced this issue Sep 12, 2023
muscliary pushed a commit to muscliary/wtfpython that referenced this issue Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants