@@ -145,45 +145,45 @@ which is automatically converted to a Julia type, you will have override this
145145via ` @pywith EXPR::PyObject ... ` .
146146
147147If you are already familiar with Python, it perhaps is easier to use
148- ` py" ..." ` and ` py""" ...""" ` which are equivalent to Python's
148+ ` py\ ` ...\` ` and ` py\ ` \`\` ...\`\`\` ` which are equivalent to Python's
149149[ ` eval ` ] ( https://docs.python.org/3/library/functions.html#eval ) and
150150[ ` exec ` ] ( https://docs.python.org/3/library/functions.html#exec ) ,
151151respectively:
152152
153153``` julia
154- py """
154+ py\ ` \`\`
155155import numpy as np
156156
157157def sinpi(x):
158158 return np.sin(np.pi * x)
159- """
160- py " sinpi" (1 )
159+ \`\`\`
160+ py\` sinpi\` (1)
161161` ``
162162
163163When creating a Julia module , it is a useful pattern to define Python
164164functions or classes in Julia' s ` __init__` and then use it in Julia
165- function with ` py" ..." ` .
165+ function with ` py\` ...\` ` .
166166
167167``` julia
168168module MyModule
169169
170170using PyCall
171171
172172function __init__()
173- py """
173+ py\`\`\`
174174 import numpy as np
175175
176176 def one(x):
177177 return np.sin(x) ** 2 + np.cos(x) ** 2
178- """
178+ \`\`\`
179179end
180180
181- two (x) = py " one" (x) + py " one" (x)
181+ two(x) = py\` one\` (x) + py\` one\` (x)
182182
183183end
184184```
185185
186- Note that Python code in ` py" ..." ` of above example is evaluated in a
186+ Note that Python code in ` py\` ...\` ` of above example is evaluated in a
187187Python namespace dedicated to ` MyModule` . Thus, Python function ` one`
188188cannot be accessed outside ` MyModule` .
189189
@@ -355,38 +355,38 @@ and also by providing more type information to the Julia compiler.
355355 ` @pycall function(args...)::returntype` into
356356 ` pycall(function,returntype,args...)` .
357357
358- * ` py" ..." ` evaluates ` "..." ` as Python code, equivalent to
358+ * ` py\` ...\` ` evaluates ` "..."` as Python code, equivalent to
359359 Python' s [` eval` ](https: // docs. python. org/ 3 / library/ functions. html# eval) function, and returns the result
360- converted to ` PyAny ` . Alternatively, ` py" ..." o ` returns the raw ` PyObject `
360+ converted to ` PyAny` . Alternatively, ` py\` ...\` o` returns the raw ` PyObject`
361361 (which can then be manually converted if desired). You can interpolate
362362 Julia variables and other expressions into the Python code with ` $` ,
363363 which interpolates the * value* (converted to ` PyObject` ) of the given
364364 expression--- data is not passed as a string, so this is different from
365- ordinary Julia string interpolation. e.g. ` py" sum($([1,2,3]))" ` calls the
365+ ordinary Julia string interpolation. e. g. ` py\` sum($([1 ,2 ,3 ]) )\` ` calls the
366366 Python ` sum` function on the Julia array ` [1,2,3]` , returning ` 6` .
367367 In contrast, if you use ` $$` before the interpolated expression, then
368368 the value of the expression is inserted as a string into the Python code,
369369 allowing you to generate Python code itself via Julia expressions.
370- For example, if ` x="1+1" ` in Julia, then ` py"$x" ` returns the string ` "1+1" ` ,
371- but ` py" $$x" ` returns ` 2 ` .
372- If you use ` py""" ...""" ` to pass a * multi-line* string, the string can
370+ For example, if ` x="1+1"` in Julia, then ` py\` $x \` ` returns the string ` "1+1"` ,
371+ but ` py\` $$x \` ` returns ` 2` .
372+ If you use ` py\`\`\` ...\`\`\` ` to pass a * multi- line* string, the string can
373373 contain arbitrary Python code (not just a single expression) to be evaluated,
374374 but the return value is ` nothing` ; this is useful e. g. to define pure- Python
375375 functions, and is equivalent to Python' s
376376 [` exec` ](https: // docs. python. org/ 3 / library/ functions. html# exec) function.
377- (If you define a Python global ` g ` in a multiline ` py""" ...""" `
378- string, you can retrieve it in Julia by subsequently evaluating ` py"g" ` .)
377+ (If you define a Python global ` g` in a multiline ` py\`\`\` ...\`\`\` `
378+ string, you can retrieve it in Julia by subsequently evaluating ` py\` g \` ` .)
379379
380- When ` py" ..." ` is used inside a Julia module, it uses a Python namespace
380+ When ` py\` ...\` ` is used inside a Julia module , it uses a Python namespace
381381 dedicated to this Julia module . Thus, you can define Python function
382- using ` py""" ....""" ` in your module without worrying about name clash
382+ using ` py\`\`\` ....\`\`\` ` in your module without worrying about name clash
383383 with other Python code. Note that Python functions _must_ be defined in
384384 ` __init__` . Side- effect in Python occurred at top- level Julia scope
385385 cannot be used at run- time for precompiled modules.
386386
387387* ` pybuiltin(s)` : Look up ` s` (a string or symbol) among the global Python
388388 builtins. If ` s` is a string it returns a ` PyObject` , while if ` s` is a
389- symbol it returns the builtin converted to ` PyAny ` . (You can also use ` py"s" `
389+ symbol it returns the builtin converted to ` PyAny` . (You can also use ` py\` s \` `
390390 to look up builtins or other Python globas.)
391391
392392Occasionally, you may need to pass a keyword argument to Python that
0 commit comments