pretty standard stuff. I did however notice that the dir(x) told me about __class__,
__reduce__ and __reduce_ex__ where the help(x) made no mention of them. Why is
this difference? I presume the two commands using different means of getting at
and displaying the methods for an object?
help() giving me all of the useful methods an object has which I’m encouraged
to make use of, whereas dir gives me a complete list of everything that object
can ‘do’ including those methods which aren’t really meant
for public consumption?
P.S. Posting from work,
so I’ve configured this mail software to post to this address in plain
text. I’m hoping this email is going to get converted to plain text when
I hit send, as it looks decidedly html/rich text as I type…
Steve Flynn | Technical Architect | Life & Pensions Services
| Capita | The Grange, Bishops Cleeve, GL52 8XX
Capita Life &
Pensions Services Limited is registered in England No 4359665
Capita Life &
Pensions Regulated Services Limited is registered in England No 2424853
Registered office: 71 Victoria Street, Westminster, London
Capita Life &
Pensions Regulated Services Limited is authorised and regulated by the
Financial Services Authority.
This email and any attachment to it are confidential. Unless you are the intended recipient, you may not use, copy or disclose either the message or any information contained in the message. If you are not the intended recipient, you should delete this email and notify the sender immediately.
Any views or opinions expressed in this email are those of the sender only, unless otherwise stated. All copyright in any Capita material in this email is reserved.
All emails, incoming and outgoing, may be recorded by Capita and monitored for legitimate business purposes.
Capita exclude all liability for any loss or damage arising or resulting from the receipt, use or transmission of this email to the fullest extent permitted by law.
Re: [Tutor] Python 3.2 - difference between out of dir() and help()
Flynn, Stephen (L & P - IT) wrote:
> All pretty standard stuff. I did however notice that the
> dir(x) told me about __class__, __reduce__ and __reduce_ex__ where the
> help(x) made no mention of them. Why is this difference? I presume the
> two commands using different means of getting at and displaying the
> methods for an object?
Yes. Both help() and dir() attempt to give an "interesting" list of
attributes, and both have different ideas of what counts as "interesting".
There is no hard rules as to what they will give, consequently they may change
from version to version. Any differences are unlikely to be deliberate, but
merely side-effects of the specific implementation of each.
By the way, help() is a complete interactive environment. Just call help()
with no arguments and follow the prompts.
> Is help() giving me all of the useful methods an object
> has which I'm encouraged to make use of, whereas dir gives me a complete
> list of everything that object can 'do' including those methods which
> aren't really meant for public consumption?