Hi Dima, On 2018-09-30, Dima Pasechnik <dimp...@gmail.com> wrote: > it was written before optional parameters era in GAP, as far as I know. > Anyhow, you can use GAP's PushOptions() and PopOptions() to achieve more or > less > the same effect, with a big uglier syntax.
"Uglier" only internally. I think it shouldn't be too difficult to modify libgap's functions so that optional parameters (passed in the usual pythonic way) are first pushed and eventually popped from GAP's global optional value stack. When I first saw your work-around, I though it would have ugly side-effects. But I just realise that it wouldn't change GAP's behaviour. For instance: gap> test := function() > local foo; > foo := ValueOption("foo"); > Print(foo); > end; function( ) ... end gap> f := function() > local foo; > foo := ValueOption("foo"); > Print("Original value ",foo); > test(); > end; function( ) ... end gap> f(); Original value failfail gap> f(:foo:=5); Original value 55 Note that the option set when calling the outer function is also present in the inner function, and that's the same when directly pushing to the global option stack: gap> PushOptions(rec(foo:=5)); gap> f(); Original value 55 gap> PopOptions(); gap> f(); Original value failfail So, that would work as desired. Best regards, Simon -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.