[Numpy-discussion] OpenOpt Suite release 0.45
Wed Apr 10 04:47:09 CDT 2013
On Wed, 2013-04-10 at 11:45 +0200, Sebastian Berg wrote:
> On Wed, 2013-04-10 at 11:54 +0300, Dmitrey wrote:
> > On 04/10/2013 10:31 AM, Robert Kern wrote:
> This is all good and nice, but Robert is still right. For dictionaries
> to work predictable you need to ensure two things.
> if object1 == object2:
> assert bool(hash(object1) == hash(object2))
> and second, which is your case for the dictionary lookup to be
> predictable this must always work:
> keys, values = zip(*dictionary.keys())
sorry dictionary.items() of course.
> assert(keys.count(object2) == 1)
> index = keys.index(object2)
> value = values[index]
> And apparently this is not the case and it simply invites bugs which are
> impossible to track down because you will not see them in small tests.
> Instead you will have code that runs great for toy problems and can
> suddenly break down in impossible to understand ways when you have large
> So hopefully the list fixes you mention provide that the second code
> block will work as you would expect dictionary[object2] to work, but if
> this is not the case...
> - Sebastian
> > As I had mentioned, removing mapping oofuns as dict keys is mere
> > impossible - this is fundamental thing whole FuncDesigner is build on,
> > as well as its user API.
> > D.
> > _______________________________________________
> > NumPy-Discussion mailing list
> > NumPy-Discussion@scipy.org
> > http://mail.scipy.org/mailman/listinfo/numpy-discussion
> NumPy-Discussion mailing list
More information about the NumPy-Discussion