Re: Class confusion

2013-01-09 Thread MRAB
On 2013-01-09 20:13, Rodrick Brown wrote: How can I make a class that has methods with attributes and other functions? I see a lot of code I'm reading the documentation to Redhat's Satellite software which has a XMLRPC interface and wrote the following code to test the api. I would like to

Re: Class confusion

2013-01-09 Thread Matt Jones
# Something like... class SystemList(object): def get_systemid(self): return System Id: bleh def get_running_kernel(self): return Kernel: bleh class SatelliteConnect(object): def get_systemlist(self): return SystemList() # Now the code you wrote would work, only

Re: Class confusion

2013-01-09 Thread Rodrick Brown
On Wed, Jan 9, 2013 at 4:34 PM, Matt Jones matt.walker.jo...@gmail.comwrote: # Something like... class SystemList(object): def get_systemid(self): return System Id: bleh def get_running_kernel(self): return Kernel: bleh class SatelliteConnect(object): def

Re: Class confusion

2013-01-09 Thread Rodrick Brown
Can anyone care to advise on the following? Based on the responses does this look sufficient? #!/opt/local/bin/python class SystemList(object): sysmap = { '1039' : 'nebula', '1040' : 'mercury'} def __init__(self, sysid): self.sysid = sysid def

Re: Class confusion

2013-01-09 Thread Matt Jones
Does this look sufficient for what? You haven't actually told us what it is you're trying to accomplish. I gave you the how, you must supply the why. *Matt Jones* On Wed, Jan 9, 2013 at 6:43 PM, Rodrick Brown rodrick.br...@gmail.comwrote: Can anyone care to advise on the following? Based on