Hi, On 2014-05-29, baby bunny <[email protected]> wrote: > Hi, I'm new to sage. I'm reading the tutorial and trying out examples. But > when I try this example: > > sage: class Evens(list): > ... def __init__(self, n): > ... self.n = n > ... list.__init__(self, range(2, n+1, 2)) > ... def __repr__(self): > ... return "Even positive numbers up to n." > > > sage: e = Evens(10) > sage: e > Even positive numbers up to n. > > from http://www.sagemath.org/doc/tutorial/tour_help.html, > after entering the class definition, when I type in > e = Evens(10) > I get the error: TypeError: 'sage.rings.integer.Integer' object is not > iterable > Why is that?
The example works for me. Did you perhaps make a misprint when you tried it? For example, if you misspelled "__init__" (double underscore in the beginning and in the end), then Evens(10) would exactly result in the error you describe. Best regards, Simon -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
