I like this. It is basically what I couldn't figure out how to
reasonably do when I refactored expand. It would remove the need for
the dummy functions expand_log, expand_mul, and so on. Also, do you
think that powsimp() could benefit from this? When I rewrote it
several weeks ago, I added a switch "combine" to control the two
different combining methods (see the docstring for more info). So
basically, you can do combine='exp' to only combine exponentials,
combine='base' to only combine bases, and combine='all' (the default)
to do both. I think we could probably use your function to do
exp=True and base=True. Also, I think my dsolve hints function that I
am writing could benefit from this.
If we do this, we will have to change documentation, as well as usage
of several expand() functions in code and tests because currently,
doing <log, mul, power_exp, ...>=True is a no-op, so it needs to be
made clear that it isn't any longer.
Also, see my comments below.
Aaron Meurer
Maybe you should also add a default_dict=True that takes in a
dictionary of default options, incase there is a function that uses
**kwargs instead of default arguments. It would also allow default
options to be False instead of True, though I don't know how much that
would complicate the rules that you have outlined below.
> """Given a dictionary of switch values (True, False, or None)
> return the dictionary with switches True or False according to
> the following logic:
>
> -if all swtiches have been set and there are no None values,
> change nothing;
> -if all switches are neutral (value = None) set them all to the
> default value;
> -if some switches are True and some are False then set the rest to
> the default value;
On the two lines below, I assume you mean "if one or more switches
have been set to True and none are set to False". It is a little
ambiguous the way you have it.