Re: [sage-devel] Permissive _element_constructor_ in Primes()

2015-02-01 Thread Eric Gourgoulhon
Thank you Vincent for this ultra-fast answer! -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send

Re: [sage-devel] Permissive _element_constructor_ in Primes()

2015-02-01 Thread Vincent Delecroix
Bonsoir Eric, Primes() is using the default _element_constructor_ from the category. There is no check at all. Actually, it would make sense to add a containment test at the end of the construction. Something along def _element_constructor_(self, data): i = super(self, X)._element_constructor

[sage-devel] Permissive _element_constructor_ in Primes()

2015-02-01 Thread Eric Gourgoulhon
Hi, While playing with prime numbers to understand facade sets in Sage, I noticed the following surprising behavior: sage: P = Primes() ; P Set of all prime numbers: 2, 3, 5, 7, ... sage: P.facade_for() (Integer Ring,) sage: P(4) 4 sage: P(4) in P False The culprit is _element_constructor_: s