[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: pytave: py.foo support
From: |
Mike Miller |
Subject: |
Re: pytave: py.foo support |
Date: |
Thu, 28 Jul 2016 16:11:20 -0700 |
User-agent: |
Mutt/1.6.0 (2016-04-01) |
On Thu, Jul 28, 2016 at 15:57:45 -0700, Colin Macdonald wrote:
> Mike,
>
> This is awesome! I tried this a long time ago but I found I couldn't do
> "subsref" on the static class (I had to instantiate a `py = pyfactory()`
> sort of hack before `py.foo` would call `subsref`).
>
> I read your code but I don't see the secret? Maybe I tried with a classdef
> style class... or just general incompentence on my part!
Exactly, old-style class vs classdef. I tried both as well until I got
something that worked ;)
I think this is because classdef handle classes can have static methods,
so py.foo would be a method call on the class, but for old-style classes
it's interpreted the same as py().foo.
I thought we might be getting to the point where this would work, and it
turned out to be pretty easy.
> Anyway, its very nice!
I hope it is fun and useful to everyone, and the Python syntax
immediately becomes a lot nicer to deal with.
sys = py.sys ## equivalent to "import sys" in Python
disp (sys.version)
s = sys.stdin.readline ()
py.os.uname ()
Still some interesting differences and problems to work out, help is
always welcome.
--
mike