Inspired a bit by the SymPyDeprecationWarning, I am looking at how we might make it easier to write error message in the code. One of the headaches is handling longer error messages.
method 1 - use string concatenation within parens; PRO simple CON: you have to remember to add a space at the beg/end of line CON: your string will just be a literal concatenation of what was typed so lines might end up being too long or too short ``` if cond: raise Error('this is the first line with trailing space ' 'this is the next line') ``` method 2 - use filldedent PRO: messages are easy to edit and guaranteed to be wrapped to given width CON: you have to import the filldedent function ``` if cond: from sympy.utilities.misc import filldedent raise Error(filldedent(''' this is the first line and here is another line at the same indentation''')) ``` Might there be an advantage to having an Error class/function which takes as input an error and a message? This would be imported once at the top of the file and could be used for all calls like this: ``` if cond: Error(ValueError,''' this is the first line of the message and another with data input: %s ''' % dat) ``` The error message would be passed to filldedent. The PRO for this is that it is clean (no cluttering filldedent in the way) and easy to maintain (in terms of fiddling with the error message). Any suggestions for a better name or implementation? -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@googlegroups.com. To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.