"Python"의 두 판 사이의 차이

ph
이동: 둘러보기, 검색
(새 문서: ==<code>is</code> and <code>==</code>== <code>is</code> is identity testing, <code>==</code> is equality testing. what happens in your code would be emulated in the interpreter like t...)
 
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:
  
>>> a = 'pub'
+
<pre><code class=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</pre></code>
  
 
[http://stackoverflow.com/a/1504742/766330]
 
[http://stackoverflow.com/a/1504742/766330]
 
 
  
 
== ==
 
== ==

2017년 4월 10일 (월) 01:33 판

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

[1]