I don't remember why I coerce the type into a string. I'm sure I had a
reason, but I don't recall it now.

I'll look into it.

On Wed, May 3, 2023 at 6:49 AM Karen K <[email protected]> wrote:

> Ok, the documentation says "It is useful for things like strings, although
> there is no reason it can't be used for other things". I used it for "other
> things" and let a service provide an observation type that is a list. In
> the LOOP packet, there it is still a list. But in the ARCHIVE record, it is
> a string instead of a list.
>
> Then assume a template that contains:
>
> #for $ii in $current.myobservationtype.raw
> do something
> #end for
>
> Here the loop goes over the characters of the string instead of the list
> elements.
>
> And it is the 'firstlast' accumulator that converts the original list to
> the string.
>
> So the conclusion is: The 'firstlast' accumulator can only be used for
> strings but not for "other things" like lists.
>
> Tom Keffer schrieb am Mittwoch, 3. Mai 2023 um 13:50:55 UTC+2:
>
>> Not following. In Python, almost anything can be converted to a string.
>> For example,
>>
>> str(complex(1,2))
>>
>> yields
>>
>> '(1+2j)'
>>
>>
>>
>> On Tue, May 2, 2023 at 10:22 PM Karen K <[email protected]> wrote:
>>
>>> I am not sure, so I don't want to edit the accumulators wiki page, but I
>>> want to ask.
>>>
>>> The wiki page says "
>>>
>>>    - firstlast. This accumulator accumulates only the first and last
>>>    entry it has seen, along with their times. It is useful for things like
>>>    strings, although there is no reason it can't be used for other things."
>>>
>>> But if I understand the code right there is a reason why this
>>> accumulator CANNOT be used for other things than strings. In line 399 of
>>> accum.py (version 4.10.2) the provided value is converted to a string. So
>>> nothing else than strings can be used with this accumulator.
>>>
>>> Should the wiki page be changed?
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "weewx-user" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/weewx-user/7d92870c-f3f6-4ca1-815c-aa729b48e8ddn%40googlegroups.com
>>> <https://groups.google.com/d/msgid/weewx-user/7d92870c-f3f6-4ca1-815c-aa729b48e8ddn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "weewx-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-user/fc94b1fd-f0fe-4a37-8707-21924aa64011n%40googlegroups.com
> <https://groups.google.com/d/msgid/weewx-user/fc94b1fd-f0fe-4a37-8707-21924aa64011n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/CAPq0zECTVQOq74p9P0Si%3DgpUi0SRCSa0wF9P_7NJq1b%3D94i6LA%40mail.gmail.com.

Reply via email to