mcmtroffaes / improb

A Python module for working with imprecise probabilities.
http://packages.python.org/improb/
GNU General Public License v2.0
10 stars 3 forks source link

Event silently makes sub-events of pspace #3

Closed equaeghe closed 13 years ago

equaeghe commented 13 years ago

class Event init function needs to be modified at lines 688-689, I think:

>>> pspace = PSpace('ab')
>>> Event(pspace, 'bc')
Event(pspace=PSpace(['a', 'b']), elements=set(['b']))

A warning/error that

>>> not (set('bc') <= set(pspace))
True

would seem appropriate.

mcmtroffaes commented 13 years ago

This is documented behaviour:

http://packages.python.org/improb/introduction.html#events

but I agree it is not intuitive. I'll change it to raise a ValueError instead.

equaeghe commented 13 years ago

Ah, yes; a wee bit cryptic perhaps if one is not familiar with python. Feel free to close this issue.

mcmtroffaes commented 13 years ago

Fixed:

https://github.com/mcmtroffaes/improb/commit/ee20e66d9bfe065a4d471073e128b2791789e33d

https://github.com/mcmtroffaes/improb/commit/dfef99e4b4de5bb41eec62a746239279a10f43a7

and also fixed another bug which was discovered thanks to the new behaviour:

https://github.com/mcmtroffaes/improb/commit/714f9cec3237b7bfea64c490505cf7f26ce72195