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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:13:20+00:00 2026-06-13T04:13:20+00:00

I am working on a project that attempts to represent an electronic circuit. This

  • 0

I am working on a project that attempts to represent an electronic circuit. This problem doesn’t deal with circuit theory, just with connections between objects.

The problem is I need to make a connection between two objects in two different ways.

I have a Component and a Node. A component has two terminals (positive and negative), each of which connects to a node. A node can have many different terminals connected to it.

So, I can have

component1.positive = node1

But if I wanted to also do

node1.add_terminal( component1.positive )

That would just give node1 a reference to itself.

I would like to be able to have Nodes contain a collection of which terminals of which components connect to it or reference it, without having to write

node1.add_terminal( component1, "positive")

or something similar.

So, is there a way to store “component1.positive”, so that it can be followed back to a Component and the specific terminal of that component? Or is there another way to represent this many-to-one and one-to-many relationship?

EDIT:

It’s important that the Node object can tell which of the two terminals of the component it was connected to.

  • 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-06-13T04:13:21+00:00Added an answer on June 13, 2026 at 4:13 am

    You can use properties. Consider this (updated):

    class Terminal(object)
        def __init__(self, component, node = None):
            self.component = component
            self.node = node
    
        def connect(self, node):
            node.add_terminal(self)
            self.node = node
    
        def disconnect(self):
            self.node.remove_terminal(self)
            self.node = None       
    
    class Component(object):
        def __init__(self):
           self._positive = Terminal(self)
    
        @property
        def positive(self):
            return self._positive
    
        @positive.setter
        def positive(self, node):
            self._positive.connect(node)
    
        @positive.deleter
        def positive(self):
            self._positive.disconnect()
    

    Usage:

    c = Component()
    n = Node()
    
    c.positive = n # at this point c.positive.connect(n) thus
                   # n.add_terminal(c.positive) is called 
    del c.positive # at this point positive is "disconnected" 
                   # from the node and vise-versa.
    # or disconnect explicitly
    c.positive.disconnect()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In a project that I'm working on I have a decision problem and none
I have a working project that Im amending, it crashes after trying to use
I'm working on project that lets users choose some scientific authors and columnists and
Im working on a project that has an implementation of JOSSO in place. We
I'm working on a project that requires to convert html email into text. Below
I'm working on a project that downloads a zip file and unzips locally. The
I'm working on a project that is trying to use context-free grammars for parsing
I am working on a project that already has begun being developed. ON some
I'm working in a project that need to get SVD (Single Values Decomposition) for
I'm working on a project that has two modules: a web and an application

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.