From b436d1704ff9c06133a22323074a2ffa3af3e871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Wed, 4 Dec 2019 06:42:18 +0100 Subject: [PATCH] Metaprograming --- README.md | 2 +- index.html | 2 +- parse.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 421bd22..0d83af7 100644 --- a/README.md +++ b/README.md @@ -2126,7 +2126,7 @@ Metaprograming **Type is the root class. If only passed an object it returns its type (class). Otherwise it creates a new class.** ```python - = type(, , ) + = type('', , ) ``` ```python diff --git a/index.html b/index.html index 412347e..37a16fd 100644 --- a/index.html +++ b/index.html @@ -1852,7 +1852,7 @@ no_of_params = len(<sig>.parameters) param_names = list(<sig>.parameters.keys()) -

#Metaprograming

Code that generates code.

Type

Type is the root class. If only passed an object it returns its type (class). Otherwise it creates a new class.

<class> = type(<class_name>, <parents_tuple>, <attributes_dict>)
+

#Metaprograming

Code that generates code.

Type

Type is the root class. If only passed an object it returns its type (class). Otherwise it creates a new class.

<class> = type('<class_name>', <parents_tuple>, <attributes_dict>)
diff --git a/parse.js b/parse.js index 04bb459..47f7954 100755 --- a/parse.js +++ b/parse.js @@ -55,7 +55,7 @@ const LRU_CACHE = ' return n if n < 2 else fib(n-2) + fib(n-1)\n'; const TYPE = - '<class> = type(<class_name>, <parents_tuple>, <attributes_dict>)'; + '<class> = type(\'<class_name>\', <parents_tuple>, <attributes_dict>)'; const DATACLASS = 'from dataclasses import make_dataclass\n' + @@ -154,7 +154,7 @@ function fixHighlights() { $(`code:contains(shutil.copy)`).html(SHUTIL_COPY); $(`code:contains(ValueError: malformed node)`).html(EVAL); $(`code:contains(@lru_cache(maxsize=None))`).html(LRU_CACHE); - $(`code:contains(, , )`).html(TYPE); + $(`code:contains(\'\', , )`).html(TYPE); $(`code:contains(make_dataclass(\'\')`).html(DATACLASS); }