(x for x in FiniteSet(1,2,3)).next() is the same as
iter(FiniteSet(1,2,3)).next() or just FiniteSet(1,2,3).args[0]

The elements of a FiniteSet are actually ordered though (this solves a few
problems and hasn't been a performance issue yet) so actually this should
always return the minimum element, which may not what you want.

The pop method of set does two things
- it returns an element
- it removes that element from the set

This doesn't make sense for FiniteSet because it is immutable. The closest
builtin class, frozenset, does not support a pop method but also forces you
to use iter.

On Tue, Jun 19, 2012 at 5:55 PM, Sergiu Ivanov
<[email protected]>wrote:

> Hello,
>
> I would like to retrieve one arbitrary element from a FiniteSet.  Is
> there a better way to do that than
>
>  (x for x in FiniteSet(1, 2, 3)).next()
>
> ?
>
> I have seen that built-in sets have the pop method, but FiniteSet
> doesn't seem to support that facility.
>
> Sergiu
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/sympy?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to