To be honest I didn't give it much thought. This is modified from the simplest code I could find that did the job.
flatten(GF(5)) does return [0,1,2,3,4], while flatten([GF(5)]) returns [Finite Field of size 5]. However, you can do: flatten([GF(5)],ltypes = (list, tuple, sage.rings.finite_field.FiniteField_prime_modn)) which returns [0,1,2,3,4]. Since I did a fair amount of python programming before using sage, I guess I tend to favor code that is purely pythonic, which might be against the grain of most sage development. -Marshall On Jun 28, 10:23 am, Nick Alexander <[EMAIL PROTECTED]> wrote: > > def flatten(in_list, ltypes=(list, tuple)): > > ... > > ltypes -- optional list of particular types to flatten > > Could you elaborate on the decisions made around iterators here? I > can see that flatten([GF(5)]) could be tricky -- is it [GF(5)] or [0, > 1, 2, 3, 4]? > > Nick --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~----------~----~----~----~------~----~------~--~---