"Python"의 두 판 사이의 차이
ph
2번째 줄: | 2번째 줄: | ||
<code>is</code> is identity testing, <code>==</code> is equality testing. what happens in your code would be emulated in the interpreter like this: | <code>is</code> is identity testing, <code>==</code> is equality testing. what happens in your code would be emulated in the interpreter like this: | ||
− | < | + | <source lang='python'>>>> a = 'pub' |
>>> b = ''.join(['p', 'u', 'b']) | >>> b = ''.join(['p', 'u', 'b']) | ||
>>> a == b | >>> a == b | ||
True | True | ||
>>> a is b | >>> a is b | ||
− | False</ | + | False</source> |
[http://stackoverflow.com/a/1504742/766330] | [http://stackoverflow.com/a/1504742/766330] | ||
== == | == == |
2017년 4월 10일 (월) 02:33 판
is
and ==
is
is identity testing, ==
is equality testing. what happens in your code would be emulated in the interpreter like this:
>>> a = 'pub'
>>> b = ''.join(['p', 'u', 'b'])
>>> a == b
True
>>> a is b
False