# excerpt from class Function (see earlier in thread): > def __pow__(self, exp): > if exp==1: return self > newself = Function(self.f) > if exp < 1: > newself = Function(self.invf) > for i in range(exp-1): > newself *= self > return newself
Note that my __pow__ definition fails to return the identify function (e.g. def e(x): return x) when the exponent is 0. f**0 should return e, where f is some Function object. Rather than fix my code right here and now, I'll leave it broken and point to this note as a cue to readers (and I'm one of those readers): feel free to add the missing functionality. Good habit in open source world: feel free to fix stuff that's broken. Sometimes the original coder just didn't need what you're adding, so it may be your job to put icing on the cake or whatever it is (hey, maybe the original coder didn't like icing). In the other hand, be aware that your fixing stuff may also break stuff, which is why in collaborative environments we like to have an audit trail and sometimes a way of rolling back repository commits, if only to establish a branch point along which to pursue some alternative (forked) development. We might call this a "schism" but often it's far friendlier than that: two promising stratagems suggest themselves and crews explore both possibilities -- no crime in that. Kirby PS: I useful title/chapter for guiding explorations of permutations, per a recommended connected topic at this point is: I.N. Herstein. Abstract Algebra. New York: Macmillan Publishing Company (c) 1986. ISBN 0-02-353820-1. See: Chapter 1, Sec. 4: A(S) (The Set of 1-1 Mappings of S Onto Itself). _______________________________________________ Edu-sig mailing list [email protected] http://mail.python.org/mailman/listinfo/edu-sig
