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


Groups > comp.lang.python > #82651 > unrolled thread

Re: problems with Methods in Python 3.4.2

Started byTerry Reedy <tjreedy@udel.edu>
First post2014-12-18 15:59 -0500
Last post2014-12-18 15:59 -0500
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: problems with Methods in Python 3.4.2 Terry Reedy <tjreedy@udel.edu> - 2014-12-18 15:59 -0500

#82651 — Re: problems with Methods in Python 3.4.2

FromTerry Reedy <tjreedy@udel.edu>
Date2014-12-18 15:59 -0500
SubjectRe: problems with Methods in Python 3.4.2
Message-ID<mailman.17040.1418936392.18130.python-list@python.org>
On 12/18/2014 12:27 PM, Marcus Lütolf wrote:

Learn to use dir to fine valid names.

> 1)I am trying to do this:
>
>  >>> dir(_builtins_)
>
> I am getting this:
>
> Traceback (most recent call last):
>
> File "<pyshell#0>", line 1, in <module>
>
>      dir(_builtins_)
>
> NameError: name '_builtins_' is not defined

 >>> dir()
['__builtins__', '__doc__', '__loader__', '__name__', '__package__', 
'__spec__']

shows the defined names.

> 2)I am trying to do this:
>
>>>> 'TTA',_add_('GGA')
>
> I’am getting this :
>
> Traceback (most recent call last):
>
> File "<pyshell#0>", line 1, in <module>
>
>      'TTA',_add_('GGA')
>
> NameError: name '_add_' is not defined

 >>> dir('a') shows string attribute names

> 3)I am trying to do this:
>
>>>> -3  .abs()
>
> I’am getting this
>
> Traceback (most recent call last):
>
>    File "<pyshell#1>", line 1, in <module>
>
>      -3 .abs()
>
> AttributeError: 'int' object has no attribute 'abs'

dir(3) shows int attributes

> 4) finally, after printing
>
>  >>>abs._doc_()
>
> I am getting this (and so on) :
>
> Traceback (most recent call last):
>
>    File "<pyshell#2>", line 1, in <module>
>
>      abs._doc_()
>
> AttributeError: 'builtin_function_or_method' object has no attribute '_doc_'

dir(abs) ditto

> What did I do wrong ?

You did not use the interactive help already available.  help(<object>) 
is also very useful.

-- 
Terry Jan Reedy

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web