Okay, the lazy attribute stuff works. I haven't stress tested it yet
because some design options have popped up and I need feedback on what's
needed.
Here goes:
1) Do we need the ability to assign to a lazy attribute?
This is a pure design choice:
- Assigning could be made to simply overwrite the lazy value. In fact
this is what's happening out of the box in Python.
- Alternatively, overwriting could be prevented, for uniformity and
because lazy evaluation and nonconstant values don't mix well,
conceptually. (Actually, Python's semantics is weak on that kind of
problem anyway, so we might say we don't care and depend on nobody doing
something nonsensical.)
2) Do we need the ability to reset a lazy attribute so that it will be
reevaluate on next use? (Could be useful to cut down on cache sizes and
such.)
Complications hovering in the background:
A) I have the code for resetting lazy attributes on instances, but I
don't have code for resetting lazy class attributes.
The issue is that class instances come with an override mechanism to
handle a variable and a method of the same name at the same time (the
variable overrides the method). I'd have to code a similar mechanism for
the class itself, and it's going to raise namespace conflict issues and
have a performance impact on deletion of any attribute - which is
probably not a problem but checking that would be an extra mile I'd like
to avoid.
B) There's the occasional oldstyle class in Sympy, and I haven't yet
investigated about how these handle class and instance attributes. I'd
prefer it if they all could be converted to newstyle in case they need a
lazy attribute, I wouldn't have to worry about the oldstyle class case.
Here's the list of classes (excluding test classes, where no attribute
laziness is supposed to be required ever):
assumptions.ask.Q
combinatorics.subsets.Subset
core.multidimensional.vectorize
core.mul.NC_Marker
mpmath.calculus.optimization.Newton
mpmath.calculus.optimization.Secant
mpmath.calculus.optimization.MNewton
mpmath.calculus.optimization.Halley
mpmath.calculus.optimization.Muller
mpmath.calculus.optimization.Bisection
mpmath.calculus.optimization.Illinois
mpmath.calculus.optimization.Ridder
mpmath.calculus.optimization.ANewton
mpmath.calculus.optimization.MDNewton
mpmath.calculus.quadrature.QuadratureMethods
mpmath.functions.rszeta.RSCache
mpmath.libmp.libmpf.h_mask_big
mpmath.mactrices.calculus.MatrixCalculusMethods
mpmath.mp_ctx_mp.PrecisionManager
mpmath.mp_ctx_python.PythonMPContext
ntheory.generate.Sieve
parsing.maxima.MaximaHelpers
parsing.sympy_tokenize.Untokenizer
plotting.pygletplot.plot.ScreenShot
series.gruntz.Node
utilities.autowrap.CodeWrapper
--
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.