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 417k
  • Answers 417k
  • 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 I use this in the method handling the copy event:… May 15, 2026 at 9:41 am
  • Editorial Team
    Editorial Team added an answer I think you should not use the hibernate session transactional… May 15, 2026 at 9:41 am
  • Editorial Team
    Editorial Team added an answer The best way I can think of is calculating Classical… May 15, 2026 at 9:41 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

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.