Inline::Python 隧道模式

发布于 2025-01-18 09:35:45 字数 706 浏览 2 评论 0原文

我的Raku Inline :: Python代码模块即使禁用RS_ST方法,也会意外打印输出。

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

这是一种特殊的隧道模式吗?

My raku Inline::Python code module unexpectedly prints output even when the rs_str method is disabled.

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

Is this a special tunnelling mode?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

单挑你×的.吻 2025-01-25 09:35:45

Poisson d'Avril
四月傻瓜
перокв基仑讯
Aprilscherz

Poisson d'Avril
April Fool
першоквітневий дурень
Aprilscherz

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文