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