Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #82645 > unrolled thread
| Started by | Gary Herron <gherron@digipen.edu> |
|---|---|
| First post | 2014-12-18 09:40 -0800 |
| Last post | 2014-12-18 09:40 -0800 |
| 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.
Re: problems with Methods in Python 3.4.2 Gary Herron <gherron@digipen.edu> - 2014-12-18 09:40 -0800
| From | Gary Herron <gherron@digipen.edu> |
|---|---|
| Date | 2014-12-18 09:40 -0800 |
| Subject | Re: problems with Methods in Python 3.4.2 |
| Message-ID | <mailman.17038.1418925008.18130.python-list@python.org> |
[Multipart message — attachments visible in raw view] — view raw
On 12/18/2014 09:27 AM, Marcus Lütolf wrote:
>
> Hello Dears,
>
> 1)I am trying to do this:
>
> >>> dir(_builtins_)
>
It's __builtins__ not _builtins_ (double underscores at each end not
single underscores)
>
> I am getting this:
>
> Traceback (most recent call last):
>
> File "<pyshell#0>", line 1, in <module>
>
> dir(_builtins_)
>
> NameError: name '_builtins_' is not defined
>
> 2)I am trying to do this:
>
> >>> 'TTA',_add_('GGA')
>
To call a method use "." not ",". And the method you are trying to
call is __add__ not _add_. But why... just do "TTA"+"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
>
> 3)I am trying to do this:
>
> >>> -3 .abs()
>
abs is a function not a method. do: abs(-3)
> 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'
>
> 4) finally, after printing
>
> >>>abs._doc_()
>
Again, use double underscores 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_'
>
> What did I do wrong ? Thanks for help, Marcus Luetolf, M.D., 90
> Bondastreet, CH-7000 Chur, Switzerland.
>
>
--
Dr. Gary Herron
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418
Back to top | Article view | comp.lang.python
csiph-web