ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 03 Dec 2018 19:18:05 +0100Sagemanifold - `only_nonredundant = True` by defaulthttps://ask.sagemath.org/question/44558/sagemanifold-only_nonredundant-true-by-default/ Hi, I find the option `only_nonredundant=True` really helpful, but it is annoying to type over and over the option on the notebook. Is it possible to define the option globally (within a notebook)?Mon, 03 Dec 2018 18:37:06 +0100https://ask.sagemath.org/question/44558/sagemanifold-only_nonredundant-true-by-default/Answer by rburing for <p>Hi, I find the option <code>only_nonredundant=True</code> really helpful, but it is annoying to type over and over the option on the notebook. Is it possible to define the option globally (within a notebook)?</p>
https://ask.sagemath.org/question/44558/sagemanifold-only_nonredundant-true-by-default/?answer=44561#post-id-44561That would be nice to have as an option indeed. As a workaround, you could define something like
nrcomps = lambda t, **kwargs: t.display_comp(only_nonredundant=True, **kwargs)
so you can do `nrcomps(Ric)` but also pass extra arguments like `nrcomps(Ric, only_nonzero=True)`.Mon, 03 Dec 2018 19:05:20 +0100https://ask.sagemath.org/question/44558/sagemanifold-only_nonredundant-true-by-default/?answer=44561#post-id-44561Comment by Dox for <p>That would be nice to have as an option indeed. As a workaround, you could define something like </p>
<pre><code>nrcomps = lambda t, **kwargs: t.display_comp(only_nonredundant=True, **kwargs)
</code></pre>
<p>so you can do <code>nrcomps(Ric)</code> but also pass extra arguments like <code>nrcomps(Ric, only_nonzero=True)</code>.</p>
https://ask.sagemath.org/question/44558/sagemanifold-only_nonredundant-true-by-default/?comment=44562#post-id-44562Excellent! Thank you for the answer, and a wonderful use of the `lambda` function!Mon, 03 Dec 2018 19:18:05 +0100https://ask.sagemath.org/question/44558/sagemanifold-only_nonredundant-true-by-default/?comment=44562#post-id-44562