Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6243625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:10:31+00:00 2026-05-24T12:10:31+00:00

Apologize if this is duplicate – not sure how to word what Im trying

  • 0

Apologize if this is duplicate – not sure how to word what I”m trying to accomplish.

I have two class’ of interest here (in brief):

class Patient:
    ...
    self.weight = (some float)
    self.medicationDays = (some float)
    self.AverageWeightChange = (some float)
    etc.

class PtAnalyzer:
    ...
    self.ptList1 = [listOfPatients]
    self.ptList2 = [anotherListOfPatients]

    def getSummaryStats(self,ptList,metric):
        list = [patient.metric for patient in ptList]
        self.getStats(list)
        return list

    def sendForStats(self):
        weightStats = self.getSummaryStats(self.ptList1, metric = weight)
        avgWeightStats = self.getSummaryStats(self.ptList1, metric = AverageWtChange)
        ...

So the program gathers a bunch of patient instances, then passes them off to the PtAnalyzer which has an attribute – a list holding the Patient instances. Since most of the patient Metrics I”m analyzing are simple floats, I can run stats on them in a standard fashion, though I need to convert the metrics to a list first (for the stats function).

My Question: How can I tell the getSummaryStats function which metric to use? I’m trying to not write separate functions for each metric – seems non-parsimonious.

(This is actually run in a Jython 2.5.2 environment as it needs JDBC, though I use no other Jython spec. functionality)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T12:10:32+00:00Added an answer on May 24, 2026 at 12:10 pm

    You want getattr(); pass the metric to use as a string.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I apologize is this is a duplicate and I just could not phrase the
I apologize if this is a duplicate. Let's say I have a JavaScript function
I apologize if this is a duplicate but I did not find anything that
I apologize if this question is a duplicate. I have read many other mysqli
I apologize if this is a duplicate question, I searched a bit and couldn't
My apologies if this is a duplicate; I may not know the proper terms
I apologize if this is a duplicate post, but I couldn't find the answer
I apologize if this is a duplicate but I couldn't find any solutions that
Possible Duplicate: Where is EntityConfiguration in EF4 VS 2010 RTM? I apologize if this
I would like to apologize if the duplicate of this question exist. i tried

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.