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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:06:55+00:00 2026-05-14T21:06:55+00:00

I have this following python code, it works fine in python but fails with

  • 0

I have this following python code, it works fine in python but fails with the following error in IronPython 2.6 any ideas as to why?

    ======================================================================
ERROR: testAutoProp (__main__.testProperty)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "oproperty.py", line 66, in testAutoProp
    a.x = 200
  File "oproperty.py", line 31, in __set__
    getattr(obj, self.fset.__name__)(value)
AttributeError: 'A' object has no attribute '<lambda$48>'

----------------------------------------------------------------------
Ran 1 test in 0.234s

FAILED (errors=1)

Here is the code

#provides an overridable version of the property keyword
import unittest

#provides an overridable version of the property keyword

class OProperty(object):
  """Based on the emulation of PyProperty_Type() in Objects/descrobject.c"""

  def __init__(self, fget=None, fset=None, fdel=None, doc=None):
    self.fget = fget
    self.fset = fset
    self.fdel = fdel
    self.__doc__ = doc

  def __get__(self, obj, objtype=None):
    if obj is None:
      return self
    if self.fget is None:
      raise AttributeError, "unreadable attribute"
    if self.fget.__name__ == '<lambda>' or not self.fget.__name__:
      return self.fget(obj)
    else:
      return getattr(obj, self.fget.__name__)()

  def __set__(self, obj, value):
    if self.fset is None:
      raise AttributeError, "can't set attribute"
    if self.fset.__name__ == '<lambda>' or not self.fset.__name__:
      self.fset(obj, value)
    else:
      getattr(obj, self.fset.__name__)(value)

  def __delete__(self, obj):
    if self.fdel is None:
      raise AttributeError, "can't delete attribute"
    if self.fdel.__name__ == '<lambda>' or not self.fdel.__name__:
      self.fdel(obj)
    else:
      getattr(obj, self.fdel.__name__)()

def autoProperty( attrname, desc ):
  "Try to auto gen getters and setting for any property type"
  getFn = lambda self: getattr( self, attrname )
  setFn = lambda self, v: setattr( self, attrname, v )
  #set the corresponding function in the descriptor
  desc.fget = getFn
  desc.fset = setFn
  #if there is a blank colname let X property sort it out
  #if hasattr( desc, "colname") and desc.colname == "":
  #  i = 0
  #  while attrname[ i ] == "_":
  #    i = i + 1
  #  desc.colname = attrname[i:]
  return desc

class testProperty(unittest.TestCase):

  def testAutoProp(self):
    class A(object):
      def __init__(self):
    self._x = 50

      x = autoProperty( "_x", OProperty() )

    a = A()
    a.x = 200


if __name__ == "__main__":
  unittest.main()
  • 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-14T21:06:55+00:00Added an answer on May 14, 2026 at 9:06 pm

    Just looking at your code and traceback, it looks to me as though lambdas on IronPython have a name such as <lambda$48> instead of just <lambda>. That means your test if self.fset.__name__ == '<lambda>' or not self.fset.__name__: will take the wrong branch.

    Try:

    if self.fset.__name__.startswith('<lambda') or not self.fset.__name__:
    

    and so on.

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

Sidebar

Ask A Question

Stats

  • Questions 492k
  • Answers 492k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Try setting android:exported="false" to all activities defined at AndroidManifest.xml That's… May 16, 2026 at 10:35 am
  • Editorial Team
    Editorial Team added an answer OK, got it. I had a copy (previous version) of… May 16, 2026 at 10:35 am
  • Editorial Team
    Editorial Team added an answer The value within the brackets is the display width. [It]… May 16, 2026 at 10:35 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a Python project that has the following structure: package1 class.py class2.py ...
I'm using rpy2 to do data analysis and plotting in python. It works fine
I'm following this tutorial but it doesn't tell me how to run this jQuery
I have been following this great guide on setting up bluetooth between 2 iPhones.
I have a Python file with as content: import re import urllib class A(object):
We build software using Hudson and Maven. We have C#, java and last, but
I'm working on a python plugin for Google Quick Search Box, and it's doing
I have been trying to use an ajax-style file upload component (like the dojox
This is weird and I'm not sure who the culprit really is. I'm doing
While developing a largeish project (split in several files and folders) in Python with

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.