true false ipython notebook

This commit is contained in:
rasbt 2014-03-19 00:38:07 -04:00
parent 212453aa3c
commit accaef2177

View File

@ -97,7 +97,23 @@
], ],
"language": "python", "language": "python",
"metadata": {}, "metadata": {},
"outputs": [] "outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"my_true_val == True: True\n",
"my_true_val is True: True\n",
"my_true_val == None: False\n",
"my_true_val is None: False\n",
"my_true_val == False: False\n",
"my_true_val is False: False\n",
"\"if my_true_val:\" is True\n",
"\"if not my_true_val:\" is False\n"
]
}
],
"prompt_number": 83
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
@ -264,7 +280,7 @@
"metadata": {}, "metadata": {},
"source": [ "source": [
"## Empty List\n", "## Empty List\n",
"It is generally not a good idea to use the `==` to check for empty lists. " "It is generally not a good idea to use the `==` to check for empty lists..."
] ]
}, },
{ {
@ -378,7 +394,7 @@
"## List comparison \n", "## List comparison \n",
"List comparisons are a handy way to show the difference between `==` and `is`. \n", "List comparisons are a handy way to show the difference between `==` and `is`. \n",
"While `==` is rather evaluating the equality of the value, `is` is checking if two objects are equal.\n", "While `==` is rather evaluating the equality of the value, `is` is checking if two objects are equal.\n",
"The examples below show that we can assign a pointer to the same list object by using `=`, e.g., `list1 = list2`. If we want to make a copy of the list values, we have to make a little " "The examples below show that we can assign a pointer to the same list object by using `=`, e.g., `list1 = list2`. If we want to make a copy of the list values, we have to make a little tweak: `list1 = list2[:]`"
] ]
}, },
{ {
@ -416,14 +432,6 @@
} }
], ],
"prompt_number": 82 "prompt_number": 82
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"outputs": []
} }
], ],
"metadata": {} "metadata": {}