Am 09.06.2012 22:55, schrieb Aleksandar Makelov:
So it's been suggested ( see the discussion of https://github.com/sympy/sympy/pull/1319 ) that we get rid of the slightly long Permutation and replace it with the shorter Perm in sympy/combinatorics/permutations.py. Keeping with this, we should also rename PermutationGroup to PermGroup in sympy/ combinatorics/perm_groups.py. It sounds like a good idea to me. Are there any objections to that?
I'm having difficulties with that - PermGroup could also mean a group of permanent objects. My knee-jerk reaction was "that's awful" for that reasons. However, that all is because I'm coming from a systems programming background, where "permanent" is an important and central concept in multiple contexts. I'm not sure how much of that would apply for someobdy with a mainly mathematical background.
Also, there was a discussion about the checks that are performed every time we construct a Permutation object - whether all numbers from 0 to n-1 are present and the arguments provided are the way they should be.
> [...]
So, do you have any suggestions about what we should do, keep the checks, remove them, or something in between?
I'd do the checks by default but offer ways (clearly marked as such) that come without the checks.
Approaches that I can see (including those that I have seen in the pull request discussion for completeness):
1) Offer a set of "safe" (checking) and a set of "unsafe" (not checking) operations. Unsafe operations are for users that know what they're doing, and for SymPy code that knows what it's doing (e.g. when passing the output from a Permutation-generating function to the input of a Permutation-taking function - the latter could be the unsafe variant.)
2) Remove the checking altogether and make it an optional thing that people may call to verify their inputs if they want it.
3) Have Permutations carry a "safe" flag. Reset it on any change that's not known to keep the Permutation properties. Set it on any change that establishes Permutation properties.
4) As (3), but don't use a flag, use the type. A "Sequence" (maybe somebody has a more precise name) is a finite list of integers. A "Permutation" is a "Sequence" where every integer between start and end is present exactly once. This approach would make it possible to reuse some permutation code for "Sequences". Cool or superfluous, I don't know :-) I'm not sure whether Python allows to change the class of an object after it was created. If not, every change between Permutation and Sequence would involve object creation; this may or may not be a problem in practice, depending on whether the Permutation code is creating new objects anyway, and depending on the actual object creation overhead.
Just my 2c. -- 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.
