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


Groups > comp.lang.python > #72045

Re: confused about the different built-in functions in Python

Date 2014-05-26 12:36 +1000
From Cameron Simpson <cs@zip.com.au>
Subject Re: confused about the different built-in functions in Python
References <648E6136A80.00000651codemonkey@inbox.com>
Newsgroups comp.lang.python
Message-ID <mailman.10327.1401071834.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 25May2014 15:55, Deb Wyatt <codemonkey@inbox.com> wrote:
>I am confused about how various built-in functions are called.  Some are
>called with dot notation
>
>each_item.isalpha()
>
>and some are called like 'normal'
>
>sum(numlist)
>
>How do you know/remember which way to call them?

Documentation.

However, some context:

each_item.isalpha() is not a builtin function as such. It is a method of the 
"str" class.

Whereas "sum" _is_ a builtin function, a globally known name which can be 
accessed and used without explicitly importing any module.

There's an explicit list of the builtin functions in the Python doco.

For a class, you can look at the doco for the class ("String methods" in the 
python doco, for the "str" class), or run:

   help(str)

at the interactive Python prompt.

Cheers,
Cameron Simpson <cs@zip.com.au>

Steinbach's Law: 2 is not equal to 3 -- even for large values of 2.

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


Thread

Re: confused about the different built-in functions in Python Cameron Simpson <cs@zip.com.au> - 2014-05-26 12:36 +1000

csiph-web