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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:30:48+00:00 2026-05-30T13:30:48+00:00

I want to execute a function in a list of objects, and store the

  • 0

I want to execute a function in a list of objects, and store the results.
My problem in the code below, is that although I try to disconnect all signals, functionC keeps triggering somehow continuously. (disconnect outputs False)

class object(...):
  def init(self):
    ...
    self.emit(SIGNAL('result(bool)', result)
    ...

class classA(...):
  def functionA(self):
    self.results=[]
    self.i=0
    self.object[...]=... # len(self.object)=n
    self.functionB()

  def functionB(self):
    self.connect(self.object[self.i], SIGNAL('result(bool)'), lambda bool: self.functionC(bool))
    self.object[self.i].init()

  def functionC(self, result):
    print self.disconnect(self.object[self.i], SIGNAL('result(bool)', lambda bool: self.functionC(bool)) # outputs False (why cannot I disconnect it?)
    self.i+=1
    self.results.append(result)
    if self.i==len(self.object):
      print "finish"
      self.i=0
      return
    self.functionB()

Anyone could imagine the problem? Thanks

  • 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-30T13:30:50+00:00Added an answer on May 30, 2026 at 1:30 pm

    I’m not sure if your code is just an example or if you really are using lambda functions for your slot. If you are indeed using a lambda, the reason is most likely because the lambda functions are completely different objects between your connect and disconnect:

    >>> fn1 = lambda bool: self.functionC(bool)
    >>> fn2 = lambda bool: self.functionC(bool)
    >>> print fn1, fn2
    <function <lambda> at 0x1004a9320> <function <lambda> at 0x1004a9398>
    >>> fn1 == fn2
    False
    >>> fn1 is fn2
    False
    

    If pyqt is storing the function references and looking for the one you specify to disconnect, it will report that its not connected. What you want to do is actually reference a persistant callback. Either store the lambda as a member attribute and reference the same one both times, or define it as a standard method or function.

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

Sidebar

Related Questions

I want to execute a function on all the objects within a List of
My problem is that I want to execute a python file with an argument
Imagine that I want to loop over a list of jQuery objects, and for
In PHP, I want to execute a function when a hyperlink is clicked. The
I want to repeatedly execute a function in Python every 60 seconds forever (just
I want to execute a php-script from php that will use different constants and
I want to execute some mysql statements that are stored in a text file
I want to execute some Python code, typed at runtime, so I get the
I want to execute this script (view source) that uses Google Translate AJAX API
I want to execute a mapreduce query, in erlang, that contains two map phases

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.