Re: [sage-devel] Re: problem with polynomial.__iter__

2014-08-29 Thread Travis Scrimshaw
I think it's better to have the iteration of vectors (elt of module-with-basis) return pairs of ``(index, coefficient)`` (over some fixed total order on the basis index set) since this will be compatible with their infinite dimensional analogues (where I do use the iteration quite a lot). Note

Re: [sage-devel] Re: problem with polynomial.__iter__

2014-08-29 Thread Nils Bruin
On Friday, August 29, 2014 3:30:08 AM UTC-7, Volker Braun wrote: > > I agree, of course.. iterators are still present ;-) What I'm saying is: > We should call such a method iter() and not iteritems() to be > forward-compatible. > I'm not so sure of that particular name! "iterating" over an elem

Re: [sage-devel] Re: problem with polynomial.__iter__

2014-08-29 Thread Volker Braun
On Friday, August 29, 2014 7:10:31 AM UTC+1, Nils Bruin wrote: > > On Thursday, August 28, 2014 1:56:31 PM UTC-7, Volker Braun wrote: >> >> iteritems() is gone in Python 3... >> > It is, but the functionality is still provided by .items() . So the > discussion of what the semantics in sage should

Re: [sage-devel] Re: problem with polynomial.__iter__

2014-08-28 Thread Nils Bruin
On Thursday, August 28, 2014 1:56:31 PM UTC-7, Volker Braun wrote: > > iteritems() is gone in Python 3... > It is, but the functionality is still provided by .items() . So the discussion of what the semantics in sage should be, is still relevant. On Thursday, August 28, 2014 9:26:34 PM UTC+1, Ni

Re: [sage-devel] Re: problem with polynomial.__iter__

2014-08-28 Thread Volker Braun
iteritems() is gone in Python 3... On Thursday, August 28, 2014 9:26:34 PM UTC+1, Nicolas M. ThiƩry wrote: > > So maybe the right way would be to instead implement iteritems for all > elements of ModulesWithBasis. > -- You received this message because you are subscribed to the Google Groups

Re: [sage-devel] Re: problem with polynomial.__iter__

2014-08-28 Thread Nicolas M. Thiery
On Mon, Aug 18, 2014 at 11:03:46PM -0700, Travis Scrimshaw wrote: >IMO we should swap the order of the pairs. It would make it consistent >with other parts of Sage too: >... I have been dreaming of this change for quite some time. I don't have an opinion on whether it's acceptable to c

[sage-devel] Re: problem with polynomial.__iter__

2014-08-18 Thread Travis Scrimshaw
IMO we should swap the order of the pairs. It would make it consistent with other parts of Sage too: sage: C = CombinatorialFreeModule(QQ, ['a','b']) sage: x = C.an_element() sage: list(x) [('a', 2), ('b', 2)] sage: F. = FreeAlgebra(QQ) sage: list(2*x + y) [(y, 1), (x, 2)] Best, Travis On Mon