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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:55:52+00:00 2026-06-10T06:55:52+00:00

I have the following decorator inside a module: class CachedProperty(object): Decorator that lazy-loads the

  • 0

I have the following decorator inside a module:

class CachedProperty(object):
    """Decorator that lazy-loads the value of a property.

    The first time the property is accessed, the original property function is
    executed. The value it returns is set as the new value of that instance's
    property, replacing the original method.
    """

    def __init__(self, wrapped):
        self.wrapped = wrapped
        try:
            self.__doc__ = wrapped.__doc__
        except:
            pass

    def __get__(self, instance, instance_type=None):
        if instance is None:
            return self

        value = self.wrapped(instance)
        setattr(instance, self.wrapped.__name__, value)

        return value

I want to import this decorator and other stuff from the module like this:

from clang.cindex import *

But I’m unable to import that single decorator this way, it works if I do:

from clang.cindex import CachedProperty

then I can use @CachedProperty.

Why can’t I import this class through * while I’m able to import others?

  • 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-10T06:55:54+00:00Added an answer on June 10, 2026 at 6:55 am

    See if there is a variable named __all__ defined near the top of your module. If so it will have a sequence (list or tuple) of string names assigned to it. These are the public names of the module which are imported by the from ... import * statement.

    Without the __all__ name defined, all names defined in a module (as well as names imported from other modules), which do not begin with an underscore, are considered to be public.

    Make sure the __all__ sequence includes the string “CachedProperty”.

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

Sidebar

Related Questions

I have the following class which is a decorator for an IDisposable object (I
I have some questions regarding the following code: 1 class Test(object): 2 def __init__(self):
I have a decorator that I wrote that will time a given function. It
I have the following code; what should be added to the decorator class to
I have the following html structure: <div class=decorator> <div class=EC_MyICHP_Item> <div class=text> <h3><a target=_blank
I have following script that executes all the .reg files in the current directory.
I have the following decorator and view which works fine. Decorator def event_admin_only(func): Checks
In my template, I have the following: <ul class=tabbed id=network-tabs> {% if user.is_authenticated %}
Please help clarifying : In web.xml I have the following <jsp-config> <jsp-property-group> <url-pattern>*.jsp</url-pattern> <el-ignored>false</el-ignored>
I have the following view within an app called 'manager': class AddObj(CreateView): model =

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.