From f146cbd9389dc2c9931316123b969c0d83b5deb7 Mon Sep 17 00:00:00 2001 From: Chris Nuernberger Date: Wed, 29 Mar 2023 13:46:52 -0600 Subject: [PATCH] Updating class docs --- docs/libpython-clj2.python.class.html | 34 +++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 docs/libpython-clj2.python.class.html diff --git a/docs/libpython-clj2.python.class.html b/docs/libpython-clj2.python.class.html new file mode 100644 index 0000000..f28aecf --- /dev/null +++ b/docs/libpython-clj2.python.class.html @@ -0,0 +1,34 @@ + +libpython-clj2.python.class documentation

libpython-clj2.python.class

Namespace to help create a new python class from Clojure. Used as a core +implementation technique for bridging JVM objects into python.

+

create-class

(create-class name bases cls-hashmap)

Create a new class object. Any callable values in the cls-hashmap +will be presented as instance methods. +Things in the cls hashmap had better be either atoms or already converted +python objects. You may get surprised otherwise; you have been warned. +See the classes-test file in test/libpython-clj

+

make-kw-instance-fn

(make-kw-instance-fn clj-fn & [{:keys [arg-converter result-converter], :or {arg-converter py-base/as-jvm}, :as options}])

Make an instance function - a function which will be passed the 'this' object as +it's first argument. In this case the default behavior is to +pass as-jvm bridged python object ptr args and kw dict args to the clojure function without +marshalling. Self will be the first argument of the arg vector.

+

See options to libpython-clj2.python/make-callable.

+

Options:

+
    +
  • :arg-converter - gets one argument and must convert into jvm space - defaults to as-jvm.
  • +
  • :result-converter - gets one argument and must convert to python space. +Has reasonable default.
  • +
+

make-tuple-instance-fn

(make-tuple-instance-fn clj-fn & [{:keys [arg-converter], :or {arg-converter py-base/as-jvm}, :as options}])

Make an instance function - a function which will be passed the 'this' object as +it's first argument. In this case the default behavior is to +pass raw python object ptr args to the clojure function without marshalling +as that can add confusion and unnecessary overhead. Self will be the first argument. +Callers can change this behavior by setting the 'arg-converter' option as in +'make-tuple-fn'.

+

See options to libpython-clj2.python/make-callable.

+

py-fn->instance-fn

(py-fn->instance-fn py-fn)

Given a python callable, return an instance function meant to be used +in class definitions.

+
\ No newline at end of file