This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author keith
Recipients keith
Date 2021-02-14.18:15:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1613326558.98.0.582713078239.issue43220@roundup.psfhosted.org>
In-reply-to
Content
Here's an example outside of argparse showing this is caused by the `is` comparison with interned string:

```
import sys

short_string = sys.argv[1]
short_default = '1'
long_string = sys.argv[2]
long_default = 'not-interned'

print(f"short comparisons: id1: {id(short_default)} id2: {id(short_string)}, eq: {short_default == short_string}, is: {short_default is short_string}")
print(f"long comparisons: id1: {id(long_default)} id2: {id(long_string)}, eq: {long_default == long_string}, is: {long_default is long_string}")
```

```
% ./python.exe /tmp/foo.py 1 not-interned
short comparisons: id1: 4523386416 id2: 4523386416, eq: True, is: True
long comparisons: id1: 4524440064 id2: 4523395296, eq: True, is: False
```
History
Date User Action Args
2021-02-14 18:15:59keithsetrecipients: + keith
2021-02-14 18:15:58keithsetmessageid: <1613326558.98.0.582713078239.issue43220@roundup.psfhosted.org>
2021-02-14 18:15:58keithlinkissue43220 messages
2021-02-14 18:15:58keithcreate