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

  • Home
  • SEARCH
  • 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 587511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:13:12+00:00 2026-05-13T15:13:12+00:00

Using a class that has an xmlrpc proxy as one of it’s object’s properties

  • 0

Using a class that has an xmlrpc proxy as one of it’s object’s properties

def __init__(self):
    self.proxy = ServerProxy(...)
    # ...

I’m trying to ease the use of some of the proxy’s functions. Only a subset of the proxy functions are supposed to be used and I thus thought of creating a set of tiny wrapper functions for them like

def sample(self):
    """ A nice docstring for a wrapper function. """
    self.proxy.sample()

Is there a good way of getting a list of all the wrapper functions? I’m thinking about something like dir(), but then I would need to filter for the object’s wrapper functions. xmlrpc introspection (http://xmlrpc-c.sourceforge.net/introspection.html) doesn’t help much either since I don’t want to use/ provide all the server’s functions.

Maybe setting an attribute on the wrappers together with a @staticmethod get_wrappers() would do the trick. Having a _wrapper suffix is not appropriate for my use case. A static list in the class that keeps track of the available is too error prone. So I’m looking for good ideas on how to best getting a list of the wrapper functions?

  • 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-13T15:13:12+00:00Added an answer on May 13, 2026 at 3:13 pm

    I’m not 100% sure if this is what you want, but it works:

    def proxy_wrapper(name, docstring):
        def wrapper(self, *args, **kwargs):
            return self.proxy.__getattribute__(name)(*args, **kwargs)
        wrapper.__doc__ = docstring
        wrapper._is_wrapper = True
        return wrapper
    
    class Something(object):
        def __init__(self):
            self.proxy = {}
    
        @classmethod
        def get_proxy_wrappers(cls):
            return [m for m in dir(cls) if hasattr(getattr(cls, m), "_is_wrapper")]
    
        update = proxy_wrapper("update", "wraps the proxy's update() method")
        proxy_keys = proxy_wrapper("keys", "wraps the proxy's keys() method")    
    

    Then

    >>> a = Something()
    >>> print a.proxy
    {}
    >>> a.update({1: 42})
    >>> print a.proxy
    {1: 42}
    >>> a.update({"foo": "bar"})
    >>> print a.proxy_keys()
    [1, 'foo']
    >>> print a.get_proxy_wrappers()
    ['proxy_keys', 'update']
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 294k
  • Answers 294k
  • 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 Update: There are reports this no longer works in Chrome.… May 13, 2026 at 6:40 pm
  • Editorial Team
    Editorial Team added an answer ShellExecute will execute the program in the context of the… May 13, 2026 at 6:40 pm
  • Editorial Team
    Editorial Team added an answer It really depends where you get your number from. If… May 13, 2026 at 6:40 pm

Related Questions

I make an AJAX request like so using JQuery: $.ajax({ type: GET, url: getvideo.php,
I have a base class that has an abstract getType() method. I want subclasses
I am using a 3rd party library that has a declaration like this: typedef
I've come across a Registry Class and I'm wondering whether to bother with this
I'm trying to build a generic grid view in an ASP.NET MVC application. Let

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.