From d8f54ea94f11ace2c01750324f5349a7e03c2d1c Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Fri, 4 Mar 2016 13:02:35 +0100 Subject: [PATCH] extended types --- p.tex | 47 +++++++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/p.tex b/p.tex index ce9f3e8..25a4693 100644 --- a/p.tex +++ b/p.tex @@ -50,30 +50,41 @@ print(str(i/46) + ' hoi') \section{Basics} \begin{frame}[fragile] - \frametitle{Basictypes} - \begin{block}{types} - \begin{tabular}{ll} - \mintinline{python}{bool} & \mintinline{python}{True, False}\\ - \mintinline{python}{int} & \mintinline{python}{1, -4, 999}\\ - \mintinline{python}{complex} & \mintinline{python}{4j+1, j}\\ - \mintinline{python}{float} & \mintinline{python} - {1.0, 4.5, 5e9, float('NaN'), float('inf')}\\ - \mintinline{python}{str} & \mintinline{python} - {'hi', "hi", '"', "'", """hi"""}\\ - \mintinline{python}{list} & \mintinline{python} - {[], ..., [1, 2, 3], ['a', 42], [[], [1]]}\\ - \mintinline{python}{tuple} & \mintinline{python} - {(1,), (1,2), (1, 'a', True), ((4, 3), 4)} - \end{tabular} - \end{block} + \frametitle{Built-in types} + \begin{tabular}{ll} + \mintinline{python}{bool} & \mintinline{python}{True, False}\\ + \mintinline{python}{int} & \mintinline{python}{1, -4, 999}\\ + \mintinline{python}{complex} & \mintinline{python}{4j+1, j}\\ + \mintinline{python}{float} & \mintinline{python} + {1.0, 4.5, 5e9, float('NaN'), float('inf')}\\ + \mintinline{python}{str} & \mintinline{python} + {'hi', "hi", '"', "'", """hi""", "\n\"\t", '\"'}\\ + \mintinline{python}{list} & \mintinline{python} + {[], ..., [1, 2, 3], ['a', 42], [[], [1]]}\\ + \mintinline{python}{tuple} & \mintinline{python} + {(1,), (1,2), (1, 'a', True), ((4, 3), 4)}\\ + \mintinline{python}{dict} & \mintinline{python} + {{1: 'a', 2: 'b'}, {"hi": 42, "test": {}}, {}}\\ + \mintinline{python}{set} & \mintinline{python} + {{1, 2}, {"hi", "a"}, set()}\\ + Others & \mintinline{python} + {range, bytes, bytearray, memoryview, frozenset}\\ + Special & \mintinline{python} + {type, None, ..., NotImplemented}\\ + \end{tabular} +\end{frame} + +\begin{frame}[fragile] + \frametitle{Basictypes: Operators} \begin{block}{operators} \begin{itemize} \item Numbers: \mintinline{python}{+ - / * // % @ **} - \item Comparison: \mintinline{python}{< <= > >= == != is} + \item Comparison: \mintinline{python}{< <= > >= == !=} \item Boolean: \mintinline{python}{and or not} \item Bitwise: \mintinline{python}{& | ^ ~ << >>} - \item List: \mintinline{python}{[i] [i:j] in} + \item List/Dictionary: \mintinline{python}{[i] [i:j] in} \item In place: \mintinline{python}{*= += ...} + \item Special: \mintinline{python}{is} \end{itemize} \end{block} \end{frame} -- 2.20.1