gpsd-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

is it safe to put dictwrapper in a container to use it later?


From: Beta Tester
Subject: is it safe to put dictwrapper in a container to use it later?
Date: Sat, 9 Jul 2022 10:29:21 +0200

hi,

in python, `gps.next()` returns items of type `dictwrapper`.
i want to put many of these items in a container (e.g.: queue) to handel them 
all later.

i am not sure if the data inside the `dictwrapper` are object references that 
will be reused somewhere in another call of 
`gps.next()`/`gps.read()`/`gps.waiting()`/gps.close()` so that the data in the 
stored items in the container can be modified.

at the moment, because i am not sure about that, i make a heavy recursive copy 
of the returned `dictwrapper` items and put that heavy copy to the container.

now i am wondering, if that heavy copy i really needed and waste of workload.

so my question is, is it safe to put `dictwrapper` items i get from 
`gps.next()` to a container without modifying its data in another call of 
`gps.next()`/`gps.read()`/`gps.waiting()`/gps.close()` ?

PS.: before i put the item to the container, i add the `gps.valid` value to the 
item, to not loose its validity information.

PPS.: at the moment i do not know what items data will be used in the 
containers items handler. thats the reason, why i want to put the whole item as 
is to the container and not selective item data.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]