Hello Armin,

> The test as you reported it shows the intended behavior of DictDefs;
> what did you expect, i.e. what are you trying to achieve?

Yesterday (before r17525) there was an assertion about the contains()
method when used on SomeIterators.
I tried to see what was going on, and why a SomeIterator did not contain
itself.
In the pdb session, I tried some unionof() statements, and was very
confused by the non-reproducible results...

> The two dicts are unrelated; the annotator thinks they come from
> different creation points.  Until proven otherwise the two SomeDict()s
> represent two unrelated sets of possible run-time dictionaries.

This makes sense, and is what I had in mind.

>
> >     x = unionof(dic1, dic2)
>
> This means that the two dicts actually go into the same place, so that
> the two dicts are now known to be just two different creation points for
> what is essentially the same kind of dict.  So unionof() has the
> side-effect of making def1 and def2 complete synonyms.  Now the two
> SomeDict()s stand for the same possibly larger set of run-time
> dictionaries.

Ah, I did not see the "no_side_effects_in_union" trick. Now I
understand that union() is meant to have the side-effect you
describe, and that contains() has no side-effect and is safe
to use in assertions.

Thanks for your patient explanations.


--
Amaury Forgeot d'Arc
Ubix Development
www.ubitrade.com

_______________________________________________
pypy-dev@codespeak.net
http://codespeak.net/mailman/listinfo/pypy-dev

Reply via email to