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.
Created on 2016年10月20日 04:03 by mingrammer, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Messages (2) | |||
|---|---|---|---|
| msg279011 - (view) | Author: MinJae Kwon (mingrammer) * | Date: 2016年10月20日 04:03 | |
I found bug i think about string comparison > var1 = 'aa' > var1 is 'aa' # This is True But if the string literal has special chacter (e.g., colon), the comparison results in False > var2 = ':bb' > var2 is ':bb' # This is False Check it please. |
|||
| msg279014 - (view) | Author: Eryk Sun (eryksun) * (Python triager) | Date: 2016年10月20日 04:33 | |
Interning of strings is an implementation detail for the efficient storage of variable and attribute names. A string with ':' in it cannot be a variable or attribute name and thus is not interned. But you don't need to know which strings are interned or why they're interned because correct Python code should never compare strings by identity. Use an equality comparison, e.g. (var2 == ':bb'). Generally identity comparisons are of limited use in Python, such as checking for a singleton object such as None. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:38 | admin | set | github: 72667 |
| 2016年10月20日 04:33:01 | eryksun | set | status: open -> closed nosy: + eryksun messages: + msg279014 resolution: not a bug stage: resolved |
| 2016年10月20日 04:03:48 | mingrammer | create | |