Closed pindash closed 6 years ago
I cannot reproduce your error. With a 32-bit version on macOS, I get
>>> from pyq import q
>>> def test(x,y):
... return {"x":x, "y":y}
...
>>> q.set('f',test)
k('`f')
>>> q('g:{d:`x`y!(x+x;y);d,:f (x;y)}')
k('::')
>>> q('g[4;5]')
k('::')
I am not sure why you expect any return from g, as written it properly returns ::, but if I add an explicit return, I get your expected result:
>>> q('g:{d:`x`y!(x+x;y);:d,:f (x;y)}')
k('::')
>>> q('g[4;5]')
k('`x`y!4 5')
Note that since you are using Python 2.7, the order of keys in a dictionary is not guaranteed, so your f is equally likely to return
`x`y!4 5
or
`y`x!5 4
This ambiguity, however does not seem to be able to cause a type error.
Please try to add a debug print to your function
q('g:{d:`x`y!(x+x;y);d,:0N!f (x;y)}')
and report the result.
BTW, what version of kdb+ are you using? Under kdb+ 2.x 4 5
without a suffix produces ints, not longs.
Closing as "invalid" after no response from OP.
Questions
[x] Which operating system are you using (if Linux, please provide flavour of it, i.e RedHat, CentOS or Ubuntu), is it 32-bit, or 64-bit?
[x] Which version of PyQ are you running? Please provide output of
pyq --versions
, if PyQ isn't operational, please provide Python interpreter version and PyQ versionpython -V; python3 -V; pip list | grep pyq
:[x] Which version of kdb+ are you using, is it 32-bit or 64-bit?
[x] If on 64-bit, is your
QLIC
set? Please provide outputenv | grep QLIC
on linux/macOS, orset|grep QLIC
on Windows.[x] Did you use virtual environment to install PyQ? If not, why?
[x] Where is your
QHOME
? Please provide outputenv | grep QHOME
on linux/macOS, orset|grep QHOME
on Windows.[x] Do you use Conda? If so, what version?
Steps to reproduce the issue
Expected result
Actual result
type error
Workaround
two workarounds are known change function g to g:{d:
x
y!(x+x;y);d:d,f (x;y)} explicitly cast g:{d:x
y!(x+x;y); d,:`long$f(x,y)}