Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
updating values in objects
#1


I have a class called patients in which one of the properties is "hr"; it is a list of four heart rate lists, the latter consisting of 4 values.
Example:
hr1 = [45, 50, 50, 45]
hr2 = [85, 45, 62, 77]
hr3 = [70, 104, 99, 65]
hr4 = 77, 89, 65, 103]
hr = [hr1, hr2, hr3, hr4]

There are a total of nine members of patients, each with hr and color. Color is generated from the values of one of the laists in hr.
When creating objects of class patients I initialize it with hr[0][:]. But when I try to update patients by replacing hr[0][:] with hr[1][:], I still get the same colors as generated by hr[0][:].

Here's my code.
for row in file:
person = Patient(firstName, lastName, ptid, hr)
person.color = makeColor(hr[t][:])
t = 1
for person in patients:
person.color = makeColor(hr[t][:])
Reply


Messages In This Thread
updating values in objects - by mercator - Dec-07-2017, 05:13 PM
RE: updating values in objects - by Larz60+ - Dec-07-2017, 07:18 PM
RE: updating values in objects - by mercator - Dec-07-2017, 07:41 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  logging values from constantly updating CLI app imvirgo 1 544 Sep-27-2023, 05:01 PM
Last Post: deanhystad
  Values not updating for restful call boomramada 0 1,667 Mar-13-2021, 01:08 PM
Last Post: boomramada
  updating certain values in dict. with relation to their keys malevy 17 5,360 Nov-27-2019, 02:37 PM
Last Post: buran
  Updating dictionary values Sukumar 2 2,463 Oct-03-2018, 09:53 PM
Last Post: Sukumar
  two different objects, but somehow the values are shared between them RaphaelMG 6 4,179 Apr-20-2018, 05:53 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020