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


Groups > comp.lang.python > #82651

Re: problems with Methods in Python 3.4.2

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.06; 'attribute': 0.07; 'string': 0.09; 'attributes': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'jan': 0.12; "'__doc__',": 0.16; 'nameerror:': 0.16; 'on)': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subject:problems': 0.16; 'wrote:': 0.18; 'trying': 0.19; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'finally,': 0.24; 'fine': 0.24; 'this:': 0.26; 'defined': 0.27; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'getting': 0.31; "skip:' 10": 0.31; '"",': 0.31; '>>>>': 0.31; 'names.': 0.31; 'file': 0.32; '(most': 0.33; 'subject:with': 0.35; 'skip:> 10': 0.36; 'shows': 0.36; 'wrong': 0.37; 'skip:[ 10': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'name': 0.63; 'useful.': 0.68; 'received:fios.verizon.net': 0.84; 'received:108': 0.93
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Terry Reedy <tjreedy@udel.edu>
Subject Re: problems with Methods in Python 3.4.2
Date Thu, 18 Dec 2014 15:59:33 -0500
References <329c01d01ae7$dc8d9c20$95a8d460$@bluewin.ch>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding quoted-printable
X-Gmane-NNTP-Posting-Host pool-108-16-203-145.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0
In-Reply-To <329c01d01ae7$dc8d9c20$95a8d460$@bluewin.ch>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.17040.1418936392.18130.python-list@python.org> (permalink)
Lines 82
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1418936392 news.xs4all.nl 2937 [2001:888:2000:d::a6]:56357
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:82651

Show key headers only | View raw


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

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


Thread

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

csiph-web