开发者

Using Elmer to execute Python in TCL; how do I handle keyword arguments?

I have a Python class that looks like this:

c开发者_开发技巧lass Mine:
    def __init__ (self, param1=None, param2=None, param3=None):
        self.param1 = param1
        self.param2 = param2
        self.param3 = param3

What should my Elmer glue file look like for this class? If they were all strings, I would guess this:

class Mine {

    Mine __init__ ( string, string, string ) -> create

But what if param3 is an object? Or a dictionary?

And is there any chance that Elmer supports **kwarg:

class Mine2:
    def __init__ (self, param1=None, param2=None, **kwargs):
        self.param1 = param1
        self.param2 = param2
        self.kwargs = kwargs

Thanks.


Reading the elmer docs, I'd guess that you'd be best off using the guess type as it usually “does the right thing” (and you'll have to specify them all when doing the call).

I don't know how it handles defaulted arguments or keyword lists; the documentation doesn't say at all (but looking at the code, I'd say that it doesn't handle keyword lists well). You might want to contact the author of elmer for more advice on this…

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜