diff --git a/09-objekty/09-objekty.tex b/09-objekty/09-objekty.tex index 3064f49c3dec3f15fad18f5268f1f0d72f972952..5e2906b8801b1d37c6808ecb08a73c2f840fba44 100644 --- a/09-objekty/09-objekty.tex +++ b/09-objekty/09-objekty.tex @@ -213,6 +213,42 @@ Příšerka říká: Mňauuu % ---------------------------------------------------------------------- +\begin{frame}{Dotazy na typy} + +\py{% +type(k) is Kocka +}{% +True +} + +\py{% +type(k) is Zvire +}{% +False +} + +\py{% +isinstance(k, Kocka) +}{% +True +} + +\py{% +isinstance(k, Zvire) +}{% +True +} + +\py{% +issubclass(Kocka, Zvire) +}{% +True +} + +\end{frame} + +% ---------------------------------------------------------------------- + \begin{frame}{Jak to funguje uvnitř} {\bf Prostory jmen (namespaces):}