Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.027 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'subject:Python': 0.06; 'attribute': 0.07; 'method.': 0.07; '"."': 0.16; 'nameerror:': 0.16; 'on)': 0.16; 'subject:problems': 0.16; 'underscores': 0.16; 'wrote:': 0.18; 'trying': 0.19; '>>>': 0.22; 'header:User- Agent:1': 0.23; '>>>': 0.24; 'finally,': 0.24; 'this:': 0.26; 'defined': 0.27; 'skip:" 20': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'am,': 0.29; 'getting': 0.31; "skip:' 10": 0.31; '"",': 0.31; 'gary': 0.31; 'file': 0.32; '(most': 0.33; 'subject:with': 0.35; 'but': 0.35; 'skip:> 10': 0.36; 'method': 0.36; 'thanks': 0.36; 'wrong': 0.37; 'skip:& 10': 0.38; 'to:addr :python-list': 0.38; 'recent': 0.39; 'skip:& 20': 0.39; 'help,': 0.39; '\xa0\xa0\xa0': 0.39; 'to:addr:python.org': 0.39; 'name': 0.63; 'charset:windows-1252': 0.65; 'institute': 0.72; 'received:204': 0.75; 'dr.': 0.77; 'do:': 0.91 Date: Thu, 18 Dec 2014 09:40:33 -0800 From: Gary Herron User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: problems with Methods in Python 3.4.2 References: <329c01d01ae7$dc8d9c20$95a8d460$@bluewin.ch> In-Reply-To: <329c01d01ae7$dc8d9c20$95a8d460$@bluewin.ch> Content-Type: multipart/alternative; boundary="------------000903060704000100010308" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 313 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1418925008 news.xs4all.nl 2867 [2001:888:2000:d::a6]:46261 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:82645 This is a multi-part message in MIME format. --------------000903060704000100010308 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: quoted-printable On 12/18/2014 09:27 AM, Marcus L=FCtolf wrote: > > Hello Dears, > > 1)I am trying to do this: > > >>> dir(_builtins_) > It's __builtins__ not _builtins_ (double underscores at each end not=20 single underscores) > > I am getting this: > > Traceback (most recent call last): > > File "", line 1, in > > 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=20 call is __add__ not _add_. But why... just do "TTA"+"GGA" > > I=92am getting this : > > Traceback (most recent call last): > > File "", line 1, in > > '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=92am getting this > > Traceback (most recent call last): > > File "", line 1, in > > -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 "", line 1, in > > abs._doc_() > > AttributeError: 'builtin_function_or_method' object has no attribute=20 > '_doc_' > > What did I do wrong ? Thanks for help, Marcus Luetolf, M.D., 90=20 > Bondastreet, CH-7000 Chur, Switzerland. > > --=20 Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418 --------------000903060704000100010308 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable
On 12/18/2014 09:27 AM, Marcus L=FCtol= f wrote:

Hello Dears,<= /span>

1)I am trying to do this:

=A0

>>> dir(_builtins_)


It's __builtins__ not _builtins_=A0 (double underscores at each end not single underscores)

=A0

I am getting this:

T= raceback (most recent call last):

=A0= File "<pyshell#0>", line 1, in <module>

=A0=A0=A0 dir(_b= uiltins_)

NameError: name '_builtins_' is not defined

=A0

2)I am trying to do this:

=A0

>>> 'TTA',_add_('GGA')


To call a method use "." not ",".=A0=A0 And the method you are trying= to call is __add__ not _add_.=A0 But why... just do "TTA"+"GGA"

=A0=

I=92am getting this=A0= :

T= raceback (most recent call last):

=A0= File "<pyshell#0>", line 1, in <module>

=A0=A0=A0 'TTA',_add_('GGA')

NameError: name '_add_' is not defined

=A0

3)I am trying to do this:

=A0

>>> -3 =A0.a= bs()


abs is a function not a method.=A0 do: abs(-3)

=A0=

I=92am getting this

Traceback (most recent call last):

=A0 File "<pyshell#1>", line 1, in <module>

=A0=A0=A0 -3 .ab= s()

A= ttributeError: 'int' object has no attribute 'abs'

<= o:p>=A0

4) finally, after printing

=A0

>>>abs._doc_()


Again, use double underscores abs.__doc__()

=A0

I am getting this (and so on)=A0:

T= raceback (most recent call last):

=A0= File "<pyshell#2>", line 1, in <module>

=A0= =A0=A0 abs._doc_()

A= ttributeError: 'builtin_function_or_method' object has no attribute '_doc_'<= br>
What did I do wrong=A0? Thanks for help, Marcus Luetolf, M.D., 90 Bondastreet, CH-7000 Chur, Switzerland.

=A0=



--=20
Dr. Gary Herron
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418
--------------000903060704000100010308--