Inline::Python隧道模式
Inline::Python tunneling mode
即使禁用 rs_str 方法,我的 raku Inline::Python 代码模块也会意外打印输出。
use Inline::Python;
role Series {
has $args;
has $!py = Inline::Python.new;
has $.po; #each instance has own Python Series obj
method TWEAK {
my $py-str = qq{
class RakuSeries:
def __init__(self):
self.series = pd.Series($args)
#`[
def rs_str(self):
return(str(self.series))
#]
};
$!py.run($py-str);
$!po = $!py.call('__main__', 'RakuSeries');
}
method Str {
$!po.rs_str()
}
}
say ~Series.new( args => "[1, 3, 5, 6, 8]" );
>>>
0 1
1 3
2 5
3 6
4 8
Name: anon, dtype: int64
这是一种特殊的隧道模式吗?
艾薇儿泊松
愚人节
愚人节
四月之乐
即使禁用 rs_str 方法,我的 raku Inline::Python 代码模块也会意外打印输出。
use Inline::Python;
role Series {
has $args;
has $!py = Inline::Python.new;
has $.po; #each instance has own Python Series obj
method TWEAK {
my $py-str = qq{
class RakuSeries:
def __init__(self):
self.series = pd.Series($args)
#`[
def rs_str(self):
return(str(self.series))
#]
};
$!py.run($py-str);
$!po = $!py.call('__main__', 'RakuSeries');
}
method Str {
$!po.rs_str()
}
}
say ~Series.new( args => "[1, 3, 5, 6, 8]" );
>>>
0 1
1 3
2 5
3 6
4 8
Name: anon, dtype: int64
这是一种特殊的隧道模式吗?
艾薇儿泊松 愚人节 愚人节 四月之乐