When I first started putting together some complex templates I found myself doing most of any required calculations using in-line code in the template file itself. As I became more familiar with weewx and SLEs I moved a lot of these calculations into SLEs, so much so that I tend to SLE first these days unless I have good reason not to. I recently wanted to put some in-line code in a template (it was the app temp question in the Users Group) and I thought if I can use import in a template to say import math, why not import some of the weewx modules so I could make use of the formulae in wxformulas.py and when that worked I though well why not import ValueHelper so that I can end up with a tag that has all the conversion and formatting capabilities that the native weewx tags have. That worked too. I now have a handful of lines of in-line code doing what used to take a few handfuls of code with arguably a better result.
So I am just wondering is there a downside here with this approach? The lack of code (or more appropriately tag) sharing between multiple templates is a disadvantage. Speed? Anecdotally this would seem to be negligible given the speed of todays processors. Memory overhead? Don't get me wrong I am not going to go out and move all my SLEs into in-line code - the in-line code syntax is annoying. Was just wondering. Gary