You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gtag('config','G-LN7PG6FJ2D');</script><linkrel="stylesheet" type="text/css" href="css/default.css" /><linkrel="stylesheet" type="text/css" href="highlight/solarized-light.css" /><scripttype="text/javascript" src="highlight/highlight.min.js"></script><scripttype="text/javascript" src="js/jquery.min.js"></script><scripttype="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><divid="header"><h2>Generated by <ahref="https://github.com/weavejester/codox">Codox</a> with <ahref="https://github.com/xsc/codox-theme-rdash">RDash UI</a> theme</h2><h1><ahref="index.html"><spanclass="project-title"><spanclass="project-name">libpython-clj</span><spanclass="project-version">2.024</span></span></a></h1></div><divclass="sidebar primary"><h3class="no-link"><spanclass="inner">Project</span></h3><ulclass="index-link"><liclass="depth-1 "><ahref="index.html"><divclass="inner">Index</div></a></li></ul><h3class="no-link"><spanclass="inner">Topics</span></h3><ul><liclass="depth-1 "><ahref="Usage.html"><divclass="inner"><span>LibPython-CLJ Usage</span></div></a></li><liclass="depth-1 "><ahref="embedded.html"><divclass="inner"><span>Embedding Clojure In Python</span></div></a></li><liclass="depth-1 "><ahref="environments.html"><divclass="inner"><span>Python Environments</span></div></a></li><liclass="depth-1 "><ahref="new-to-clojure.html"><divclass="inner"><span>So Many Parenthesis!</span></div></a></li><liclass="depth-1 "><ahref="scopes-and-gc.html"><divclass="inner"><span>Scopes And Garbage Collection</span></div></a></li><liclass="depth-1 "><ahref="slicing.html"><divclass="inner"><span>Slicing And Slices</span></div></a></li></ul><h3class="no-link"><spanclass="inner">Namespaces</span></h3><ul><liclass="depth-1"><divclass="no-link"><divclass="inner"><spanclass="tree"><spanclass="top"></span><spanclass="bottom"></span></span><span>libpython-clj2</span></div></div></li><liclass="depth-2 branch"><ahref="libpython-clj2.codegen.html"><divclass="inner"><spanclass="tree"><spanclass="top"></span><spanclass="bottom"></span></span><span>codegen</span></div></a></li><liclass="depth-2 branch"><ahref="libpython-clj2.embedded.html"><divclass="inner"><spanclass="tree"><spanclass="top"></span><spanclass="bottom"></span></span><span>embedded</span></div></a></li><liclass="depth-2 branch"><ahref="libpython-clj2.java-api.html"><divclass="inner"><spanclass="tree"><spanclass="top"></span><spanclass="bottom"></span></span><span>java-api</span></div></a></li><liclass="depth-2"><ahref="libpython-clj2.python.html"><divclass="inner"><spanclass="tree"><spanclass="top"></span><spanclass="bottom"></span></span><span>python</span></div></a></li><liclass="depth-3 branch current"><ahref="libpython-clj2.python.class.html"><divclass="inner"><spanclass="tree"><spanclass="top"></span><spanclass="bottom"></span></span><span>class</span></div></a></li><liclass="depth-3"><ahref="libpython-clj2.python.np-array.html"><divclass="inner"><spanclass="tree"><spanclass="top"></span><spanclass="bottom"></span></span><span>np-array</span></div></a></li><liclass="depth-2"><ahref="libpython-clj2.require.html"><divclass="inner"><spanclass="tree" style="top: -83px;"><spanclass="top" style="height: 92px;"></span><spanclass="bottom"></span></span><span>require</span></div></a></li></ul></div><divclass="sidebar secondary"><h3><ahref="#top"><spanclass="inner">Public Vars</span></a></h3><ul><liclass="depth-1"><ahref="libpython-clj2.python.class.html#var-create-class"><divclass="inner"><span>create-class</span></div></a></li><liclass="depth-1"><ahref="libpython-clj2.python.class.html#var-make-kw-instance-fn"><divclass="inner"><span>make-kw-instance-fn</span></div></a></li><liclass="depth-1"><ahref="libpython-clj2.python.class.html#var-make-tuple-instance-fn"><divclass="inner"><span>make-tuple-instance-fn</span></div></a></li><liclass="depth-1"><ahref="libpython-clj2.python.class.html#var-py-fn-.3Einstance-fn"><divclass="inner"><span>py-fn->instance-fn</span></div></a></li></ul></div><divclass="namespace-docs" id="content"><h1class="anchor" id="top">libpython-clj2.python.class</h1><divclass="doc"><divclass="markdown"><p>Namespace to help create a new python class from Clojure. Used as a core
8
+
implementation technique for bridging JVM objects into python.</p>
9
+
</div></div><divclass="public anchor" id="var-create-class"><h3>create-class</h3><divclass="usage"><code>(create-class name bases cls-hashmap)</code></div><divclass="doc"><divclass="markdown"><p>Create a new class object. Any callable values in the cls-hashmap
10
+
will be presented as instance methods.
11
+
Things in the cls hashmap had better be either atoms or already converted
12
+
python objects. You may get surprised otherwise; you have been warned.
13
+
See the classes-test file in test/libpython-clj</p>
14
+
</div></div><divclass="src-link"><ahref="https://github.com/clj-python/libpython-clj/blob/master/src/libpython_clj2/python/class.clj#L70">view source</a></div></div><divclass="public anchor" id="var-make-kw-instance-fn"><h3>make-kw-instance-fn</h3><divclass="usage"><code>(make-kw-instance-fn clj-fn & [{:keys [arg-converter result-converter], :or {arg-converter py-base/as-jvm}, :as options}])</code></div><divclass="doc"><divclass="markdown"><p>Make an instance function - a function which will be passed the 'this' object as
15
+
it's first argument. In this case the default behavior is to
16
+
pass as-jvm bridged python object ptr args and kw dict args to the clojure function without
17
+
marshalling. Self will be the first argument of the arg vector.</p>
18
+
<p>See options to <ahref="libpython-clj2.python.html#var-make-callable">libpython-clj2.python/make-callable</a>.</p>
19
+
<p>Options:</p>
20
+
<ul>
21
+
<li><code>:arg-converter</code> - gets one argument and must convert into jvm space - defaults to as-jvm.</li>
22
+
<li><code>:result-converter</code> - gets one argument and must convert to python space.
23
+
Has reasonable default.</li>
24
+
</ul>
25
+
</div></div><divclass="src-link"><ahref="https://github.com/clj-python/libpython-clj/blob/master/src/libpython_clj2/python/class.clj#L43">view source</a></div></div><divclass="public anchor" id="var-make-tuple-instance-fn"><h3>make-tuple-instance-fn</h3><divclass="usage"><code>(make-tuple-instance-fn clj-fn & [{:keys [arg-converter], :or {arg-converter py-base/as-jvm}, :as options}])</code></div><divclass="doc"><divclass="markdown"><p>Make an instance function - a function which will be passed the 'this' object as
26
+
it's first argument. In this case the default behavior is to
27
+
pass raw python object ptr args to the clojure function without marshalling
28
+
as that can add confusion and unnecessary overhead. Self will be the first argument.
29
+
Callers can change this behavior by setting the 'arg-converter' option as in
30
+
'make-tuple-fn'.</p>
31
+
<p>See options to <ahref="libpython-clj2.python.html#var-make-callable">libpython-clj2.python/make-callable</a>.</p>
32
+
</div></div><divclass="src-link"><ahref="https://github.com/clj-python/libpython-clj/blob/master/src/libpython_clj2/python/class.clj#L23">view source</a></div></div><divclass="public anchor" id="var-py-fn-.3Einstance-fn"><h3>py-fn->instance-fn</h3><divclass="usage"><code>(py-fn->instance-fn py-fn)</code></div><divclass="doc"><divclass="markdown"><p>Given a python callable, return an instance function meant to be used
0 commit comments