Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #36519

Re: Class confusion

Date 2013-01-09 21:28 +0000
From MRAB <python@mrabarnett.plus.com>
Subject Re: Class confusion
References <CABRP1o9HuUR3e5S5wj8FvNgqAW6jnqb7iBJ0yo9J+H1fNWfAxQ@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.339.1357766921.2939.python-list@python.org> (permalink)

Show all headers | View raw


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 extend this code to support methods with methods? I see
> this done a lot in python code but I'm not sure how to accomplish
> something like this?
>
> i.e.
>
> sc = SatelliteConnect()
> sc.get_systemlist().get_systemid() ?
> or
> sc.get_systemlist().get_running_kernel()
>
> How does one chain methods and attributes like this with classes?
>
[snip]
This:

     sc.get_systemlist().get_systemid()

simply means that the method "get_systemlist" returns an instance of
some class (let's call it "SystemList") which has a method
"get_systemid".

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Class confusion MRAB <python@mrabarnett.plus.com> - 2013-01-09 21:28 +0000

csiph-web