File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "metadata" : {
33 "name" : " " ,
4- "signature" : " sha256:0c860c383edcd7622b0c660eb989513e90496c7350916bae1ddb6c10f29fab2c "
4+ "signature" : " sha256:611615765638a390c8e9093179758c4a23524ddcc2379aeff80e51c22031aa18 "
55 },
66 "nbformat" : 3 ,
77 "nbformat_minor" : 0 ,
225225 ],
226226 "prompt_number" : 5
227227 },
228+ {
229+ "cell_type" : " markdown" ,
230+ "metadata" : {},
231+ "source" : [
232+ " Another popular example to illustrate the reuse of objects for small integers is:"
233+ ]
234+ },
235+ {
236+ "cell_type" : " code" ,
237+ "collapsed" : false ,
238+ "input" : [
239+ " print(256 is 257 - 1)\n " ,
240+ " print(257 is 258 - 1)"
241+ ],
242+ "language" : " python" ,
243+ "metadata" : {},
244+ "outputs" : [
245+ {
246+ "output_type" : " stream" ,
247+ "stream" : " stdout" ,
248+ "text" : [
249+ " True\n " ,
250+ " False\n "
251+ ]
252+ }
253+ ],
254+ "prompt_number" : 2
255+ },
256+ {
257+ "cell_type" : " markdown" ,
258+ "metadata" : {},
259+ "source" : [
260+ " And to illustrate the test for equality (`==`) vs. identity (`is`):"
261+ ]
262+ },
263+ {
264+ "cell_type" : " code" ,
265+ "collapsed" : false ,
266+ "input" : [
267+ " a = 'hello world!'\n " ,
268+ " b = 'hello world!'\n " ,
269+ " print('a is b', a is b)\n " ,
270+ " print('a == b', a == b)"
271+ ],
272+ "language" : " python" ,
273+ "metadata" : {},
274+ "outputs" : [
275+ {
276+ "output_type" : " stream" ,
277+ "stream" : " stdout" ,
278+ "text" : [
279+ " a is b False\n " ,
280+ " a == b True\n "
281+ ]
282+ }
283+ ],
284+ "prompt_number" : 3
285+ },
228286 {
229287 "cell_type" : " markdown" ,
230288 "metadata" : {},
Original file line number Diff line number Diff line change 11{
22 "metadata" : {
33 "name" : " " ,
4- "signature" : " sha256:0c860c383edcd7622b0c660eb989513e90496c7350916bae1ddb6c10f29fab2c "
4+ "signature" : " sha256:611615765638a390c8e9093179758c4a23524ddcc2379aeff80e51c22031aa18 "
55 },
66 "nbformat" : 3 ,
77 "nbformat_minor" : 0 ,
225225 ],
226226 "prompt_number" : 5
227227 },
228+ {
229+ "cell_type" : " markdown" ,
230+ "metadata" : {},
231+ "source" : [
232+ " Another popular example to illustrate the reuse of objects for small integers is:"
233+ ]
234+ },
235+ {
236+ "cell_type" : " code" ,
237+ "collapsed" : false ,
238+ "input" : [
239+ " print(256 is 257 - 1)\n " ,
240+ " print(257 is 258 - 1)"
241+ ],
242+ "language" : " python" ,
243+ "metadata" : {},
244+ "outputs" : [
245+ {
246+ "output_type" : " stream" ,
247+ "stream" : " stdout" ,
248+ "text" : [
249+ " True\n " ,
250+ " False\n "
251+ ]
252+ }
253+ ],
254+ "prompt_number" : 2
255+ },
256+ {
257+ "cell_type" : " markdown" ,
258+ "metadata" : {},
259+ "source" : [
260+ " And to illustrate the test for equality (`==`) vs. identity (`is`):"
261+ ]
262+ },
263+ {
264+ "cell_type" : " code" ,
265+ "collapsed" : false ,
266+ "input" : [
267+ " a = 'hello world!'\n " ,
268+ " b = 'hello world!'\n " ,
269+ " print('a is b', a is b)\n " ,
270+ " print('a == b', a == b)"
271+ ],
272+ "language" : " python" ,
273+ "metadata" : {},
274+ "outputs" : [
275+ {
276+ "output_type" : " stream" ,
277+ "stream" : " stdout" ,
278+ "text" : [
279+ " a is b False\n " ,
280+ " a == b True\n "
281+ ]
282+ }
283+ ],
284+ "prompt_number" : 3
285+ },
228286 {
229287 "cell_type" : " markdown" ,
230288 "metadata" : {},
You can’t perform that action at this time.
0 commit comments