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


Groups > comp.lang.python > #9509

Re: list(), tuple() should not place at "Built-in functions" in documentation

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!feeder3.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.85.MISMATCH!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
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:" ': 0.03; 'function,': 0.07; 'python': 0.08; 'func': 0.09; 'lambda:': 0.09; 'am,': 0.13; 'received:209.85.214.174': 0.13; 'received:mail- iw0-f174.google.com': 0.13; 'defined': 0.14; 'wrote:': 0.15; '"classic"': 0.16; 'arg2,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'function).': 0.16; 'subject:() ': 0.16; 'method.': 0.16; '>>>': 0.16; 'def': 0.16; 'subject:list': 0.16; 'subject:skip:d 10': 0.17; 'describes': 0.19; 'subject:not': 0.21; "aren't": 0.22; 'header:In-Reply-To:1': 0.22; 'here?': 0.23; 'fri,': 0.28; 'received:209.85.214': 0.28; 'message-id:@mail.gmail.com': 0.28; 'object': 0.30; 'types.': 0.30; 'class': 0.31; 'chris': 0.32; 'does': 0.32; 'to:addr:python- list': 0.34; 'functions.': 0.37; 'but': 0.37; 'received:google.com': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.38; 'created': 0.38; 'steven': 0.38; 'something': 0.38; 'to:addr:python.org': 0.39; 'might': 0.39; 'received:209': 0.40; 'here:': 0.64; '__call__': 0.84; 'subject:should': 0.84; 'subject:place': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=w7gAc43RQC2I49Ys/XAO7SmdybFFGKyNcz+DYNtexcA=; b=LUiuoOH1gy4mePhTrpGceZ1D8roSZMVcyXgbGOnD2AoGBuZYvSN3tmt37jc8wMawOF K80Ks1/O2Rsbam5d+Ii2/0O9BCIyiAksjKDB9+T7I5w26Us4SMC3+rUK0hOBqsrO7XGy l8YbgqRPuFGADwcKVUWcqYzRyNijhi69S3qmY=
MIME-Version 1.0
In-Reply-To <4e1f989e$0$29990$c3e8da3$5496439d@news.astraweb.com>
References <c420b618-bb1a-4c8f-a446-e33e6e938c93@glegroupsg2000goo.googlegroups.com> <4e1f989e$0$29990$c3e8da3$5496439d@news.astraweb.com>
Date Fri, 15 Jul 2011 16:24:07 +1000
Subject Re: list(), tuple() should not place at "Built-in functions" in documentation
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1046.1310711050.1164.python-list@python.org> (permalink)
Lines 31
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1310711050 news.xs4all.nl 23898 [2001:888:2000:d::a6]:33960
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:9509

Show key headers only | View raw


On Fri, Jul 15, 2011 at 11:32 AM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
> Inside wrote:
>
>> As telling in the subject,because "list" and "tuple" aren't functions,they
>> are types.Is that right?
>
> Yes they are types. But they can still be used as functions. Does it matter?

Python is duck-typed, even in its documentation. If Python describes
something as a function, it means it can be used in place of func in
here:

result = func(arg1, arg2, arg3)

It might be something created with def (a "classic" function). It
might be something created with lambda. It might be an object with a
__call__ method. It might be a type.

>>> class foo:
	def __call__(self):
		return lambda: print("asdf")

>>> bar=foo()
>>> quux=bar()
>>> quux()
asdf

How many functions are defined here?

Chris Angelico

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


Thread

list(),tuple() should not place at "Built-in functions" in documentation Inside <fancheyujian@gmail.com> - 2011-07-14 18:21 -0700
  Re: list(),tuple() should not place at "Built-in functions" in documentation Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-15 11:32 +1000
    Re: list(),tuple() should not place at "Built-in functions" in documentation Ben Finney <ben+python@benfinney.id.au> - 2011-07-15 11:51 +1000
      Re: list(), tuple() should not place at "Built-in functions" in documentation Terry Reedy <tjreedy@udel.edu> - 2011-07-14 23:00 -0400
      Re: list(), tuple() should not place at "Built-in functions" in documentation Stefan Behnel <stefan_ml@behnel.de> - 2011-07-15 23:03 +0200
    Re: list(), tuple() should not place at "Built-in functions" in documentation Chris Angelico <rosuav@gmail.com> - 2011-07-15 16:24 +1000
  Re: list(),tuple() should not place at "Built-in functions" in documentation rantingrick <rantingrick@gmail.com> - 2011-07-14 18:36 -0700
    Re: list(), tuple() should not place at "Built-in functions" in documentation Corey Richardson <kb1pkl@aim.com> - 2011-07-14 22:01 -0400
  Re: list(),tuple() should not place at "Built-in functions" in documentation Raymond Hettinger <python@rcn.com> - 2011-07-18 23:52 -0700
    Re: list(), tuple() should not place at "Built-in functions" in documentation Terry Reedy <tjreedy@udel.edu> - 2011-07-19 12:31 -0400
    Re: list(), tuple() should not place at "Built-in functions" in documentation Stefan Behnel <stefan_ml@behnel.de> - 2011-07-20 08:21 +0200
    Re: list(), tuple() should not place at "Built-in functions" in documentation Terry Reedy <tjreedy@udel.edu> - 2011-07-20 16:53 -0400

csiph-web