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 7683049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:42:28+00:00 2026-05-31T18:42:28+00:00

There is a python file named BasePlat.py which contain something like this: class BasePlatform(SimObj):

  • 0

There is a python file named BasePlat.py which contain something like this:

class BasePlatform(SimObj):
  type = 'BasePlatform'
  size = Param.Int(100, "Number of entries")

class Type1(BasePlatform):
  type = 'Type1'
  cxx_class = 'Type1'

Now this file is used in another file named BaseModel.py

from BasePlat import BasePlatform
class BaseModel(ModelObj):
  type = 'BaseModel'
  delay = Param.Int(50, "delay")
  platform = Param.BasePlatform(NULL, "platform")

These file define the parameters. In another file inst.py, some models are instantiated and I can modify the parameters. For example I can define two models with different delays.

class ModelNumber1(BaseModel):
  delay = 10

class ModelNumber2(BaseModel):
  delay = 15

However I don’t know how can I reach size parameter in BasePlatform. I want something like this (this is not a true code):

class ModelNumber1(BaseModel):
  delay = 10
  platform = Type1
  **platform.size = 5**

class ModelNumber2(BaseModel):
  delay = 15
  platform = Type1
  **platform.size = 8**

How can I do that?

  • 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-31T18:42:29+00:00Added an answer on May 31, 2026 at 6:42 pm

    The attributes you are defining are at class level, which means that every instance of that class will share the same objects (which are instantiated at definition time).

    If you want ModelNumber1 and ModelNumber2 to have different platform instances, you have to override their definition. Something like this:

    class ModelNumber1(BaseModel):
      delay = 10
      platform = Param.Type1(NULL, "platform", size=5)
    
    class ModelNumber2(BaseModel):
      delay = 15
      platform = Param.Type1(NULL, "platform", size=8)
    

    Edit the BasePlatform class definition with something like this:

    class BasePlatform(SimObj):
      type = 'BasePlatform'
      size = Param.Int(100, "Number of entries")
    
      def __init__(self, size=None):
        if size:
          self.size = size
          # or, if size is an integer:
          # self.size = Param.Int(size, "Number of entries")
    

    If you don’t have access to the BasePlatform definition, you can still subclass it as MyOwnBasePlatform and customize the __init__ method.

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

Sidebar

Related Questions

I have a large file named CHECKME which is tab delimited. There are 8
Is there a disadvantage to using a dynamic Python file to generate the CSS
Is there a one-liner to read all the lines of a file in Python,
I just found out this today: If I have an existing file named a111,
As per the docs,it expects this file in a folder named 'registration' in templates
Python is installed in a local directory. My directory tree looks like this: (local
Suppose in the current directory there is a file named somecode.py , and a
Python packaging tools expect that our readme file should be named README or README.txt.
I usually perform things like this in C++, but I'm using python to write
Something very strange is happening when I open FIFOs (named pipes) in Python for

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.