mirror of
https://github.com/rasbt/python_reference.git
synced 2025-03-13 17:19:52 +00:00
true false ipython notebook
This commit is contained in:
parent
212453aa3c
commit
accaef2177
@ -97,7 +97,23 @@
|
||||
],
|
||||
"language": "python",
|
||||
"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",
|
||||
@ -264,7 +280,7 @@
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 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 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",
|
||||
"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
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"collapsed": false,
|
||||
"input": [],
|
||||
"language": "python",
|
||||
"metadata": {},
|
||||
"outputs": []
|
||||
}
|
||||
],
|
||||
"metadata": {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user