Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#27 Strange behavior with two iterable

release 1.0
closed-fixed
pyke (39)
5
2009-03-26
2009-03-24
Mr.SpOOn
No

Importing a dictionary in a rule base and iterating through it with two pattern variables causes some inconsistencies.

The dictionary is this:

#dic.py
my_dic = {'one: 1, 'two': 2, 'three': 3}

And this is the rule base:

#rule.krb
dist_one
foreach
($a, $a_num) in dic.my_dic.iteritems()
($b, $b_num) in dic.my_dic.iteritems()
python print $a, $a_num, $b, $b_num
check $b_num - $a_num == 1
assert
python print $a, $b
distance.one($a, $b)

fc_extras
from my_example import dic

I expect it to iter through all values of the dictionary with both $a and $b, but what actually happens is that it puts just one value in $a and iter throug $b.

So it prints this:

three 3 three 3
three 3 two 2
three 3 one 1

Discussion

    • status: open --> closed-fixed
     
  • Fixed in svn r198 on the release_1.0 branch. Will be included in Pyke release 1.0.1.