On Mon, Nov 25, 2013 at 09:37:51AM +0100, Joachim Durchholz wrote: > Yes, but the six stuff seems to cover aspects that we don't.
Any example? // and see below > I mean stuff like this: > # It's possible to have sizeof(long) != sizeof(Py_ssize_t). > Not that this particular gem is goint to be too relevant for SymPy, > but I'm seeing things that are: > - Finding out whether a value is a primitive numeric type. from sympy.core.compatibility import integer_types > - raw_input vs. input any example of using this? If so, we can add a wrapper to the compatibility module, just like with other builtins. > - __builtin__ vs. builtins from sympy.core.compatibility import builtins > - reduce (which we should be using much more) from sympy.core.compatibility import reduce > - xrange vs. range from sympy.core.compatibility import xrange > - URL processing (for SymPy Online) The version of the six library, bundled with scipy - doesn't have this stuff as well (or raw_input). > - iterkeys, itervalues, iteritems, iterlists The current idiom, I think, is to use keys, values, etc. > There's also some metaclass and wrapper stuff that I don't know what > it does and that might or might not be relevant. from sympy.core.compatibility import with_metaclass > Also, Python version detection could always be "if PY2" and "if PY3". > In SymPy, we sometimes compare for equality with 3, sometimes Perhaps, we can refactor some(all?) such cases to using compatibility helpers/wrappers. > Yes, I needed to import __builtin__. > Which was renamed to builtins in Python 3. from sympy.core.compatibility import builtins -- You received this message because you are subscribed to the Google Groups "sympy" 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/sympy. For more options, visit https://groups.google.com/groups/opt_out.
