Search Results

Search found 2 results on 1 pages for 'daccle'.

Page 1/1 | 1 

  • Python Introspection: How to get varnames of class methods?

    - by daccle
    I want to get the names of the keyword arguments of the methods of a class. I think I understood how to get the names of the methods and how to get the variable names of a specific method, but I don't get how to combine these: class A(object): def A1(self, test1=None): self.test1 = test1 def A2(self, test2=None): self.test2 = test2 def A3(self): pass def A4(self, test4=None, test5=None): self.test4 = test4 self.test5 = test5 a = A() # to get the names of the methods: for methodname in a.__class__.__dict__.keys(): print methodname # to get the variable names of a specific method: for varname in a.A1.__func__.__code__.co_varnames: print varname # I want to have something like this: for function in class: print function.name for varname in function: print varname # desired output: A1 self test1 A2 self test2 A3 self A4 self test4 test5

    Read the article

  • Twisted: how-to bind a server to a specified IP address? (solved)

    - by daccle
    I want to have a twisted service (started via twistd) which listens to TCP/POST request on a specified port on a specified IP address. By now I have a twisted application which listens to port 8040 on localhost. It is running fine, but I want it to only listen to a certain IP address, say 10.0.0.78. How-to manage that? This is a snippet of my code: application = service.Application('SMS_Inbound') smsInbound = resource.Resource() smsInbound.putChild('75sms_inbound',ReceiveSMS(application)) smsInboundServer = internet.TCPServer(8001, webserver.Site(smsInbound)) smsInboundServer.setName("SMS Handling") smsInboundServer.setServiceParent(application)

    Read the article

1