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


Groups > comp.lang.python > #9938

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

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsreader4.netcologne.de!news.netcologne.de!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'python,': 0.01; 'subject:" ': 0.03; 'instance': 0.05; 'constructor': 0.07; 'distinction': 0.07; 'terry': 0.07; 'type,': 0.07; 'python': 0.08; 'arguments.': 0.09; 'builtin': 0.09; 'range,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'confusing.': 0.16; 'different,': 0.16; 'disagree.': 0.16; 'from:addr:behnel.de': 0.16; 'from:addr:stefan_ml': 0.16; 'from:name:stefan behnel': 0.16; 'imo,': 0.16; 'instances.': 0.16; 'subject:() ': 0.16; 'subtype': 0.16; 'classes,': 0.16; 'subject:list': 0.16; 'subject:skip:d 10': 0.17; 'functions,': 0.19; 'subject:not': 0.21; 'described': 0.22; 'header:In-Reply-To:1': 0.22; 'section.': 0.23; '(or': 0.25; 'function': 0.26; '(in': 0.26; 'keeps': 0.28; 'correct': 0.29; 'stefan': 0.29; 'cases.': 0.30; 'class': 0.31; 'sufficient': 0.32; 'list': 0.32; 'rather': 0.33; 'to:addr:python-list': 0.34; 'header:X-Complaints-To:1': 0.34; 'header:User-Agent:1': 0.34; 'difference': 0.34; 'describe': 0.34; 'module.': 0.35; 'interface.': 0.37; 'some': 0.37; 'but': 0.37; 'could': 0.37; 'received:org': 0.38; 'subject:: ': 0.38; 'something': 0.38; 'header:Mime-Version:1': 0.39; 'list,': 0.39; 'to:addr:python.org': 0.39; 'might': 0.39; 'sense': 0.40; 'perfectly': 0.64; 'details': 0.65; 'ever': 0.65; 'received:188': 0.69; 'virtually': 0.73; 'irrelevant.': 0.84; 'subject:should': 0.84; 'subject:place': 0.91; 'tied': 0.93
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Stefan Behnel <stefan_ml@behnel.de>
Subject Re: list(), tuple() should not place at "Built-in functions" in documentation
Date Wed, 20 Jul 2011 08:21:34 +0200
References <c420b618-bb1a-4c8f-a446-e33e6e938c93@glegroupsg2000goo.googlegroups.com> <89bfd3a2-e166-425d-99f6-997cc3ab18a5@v11g2000prn.googlegroups.com> <j04bh4$4sl$1@dough.gmane.org>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host ppp-188-174-53-126.dynamic.mnet-online.de
User-Agent Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110617 Lightning/1.0b2 Thunderbird/3.1.11
In-Reply-To <j04bh4$4sl$1@dough.gmane.org>
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.1279.1311142914.1164.python-list@python.org> (permalink)
Lines 31
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1311142914 news.xs4all.nl 23878 [2001:888:2000:d::a6]:50335
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:9938

Show key headers only | View raw


Terry Reedy, 19.07.2011 18:31:
> Chapter 5 is mostly about the behavior of built-in class instances. For
> some classes, like range, instances only come from class calls and the
> behavior of instances is intimately tied to the constructor arguments.
> Having the constructor described in C.5 might be useful.

I strongly disagree. To me, range() being implemented as a class or 
function is a clear implementation detail that is of no importance to 
virtually all use cases. It's only ever used as a function that returns a 
list (in Py2) or something iterable (in Py3). Whether that "iterable" is of 
type "range" or not is irrelevant. Even in Py2, it could return a subtype 
of list, and would still fulfil its interface.

So, IMO, it makes no sense to have range() described in the builtin types 
section. It would rather be confusing. It's perfectly correct and 
sufficient to describe it in the builtin functions section.

Remember that Python is duck-typed. It makes no difference if you call a 
function that returns a new instance of a type, or the type itself to 
return an instance of itself (or something completely different, if it 
wants to).

The distinction between types and functions is blurred in Python, and 
that's a good thing. Just look at the itertools module. Some of the 
"functions" are implemented as functions, some are implemented as types, 
and some are functions that delegate to a type. But they all have the same 
interface, which makes them easy to understand as a whole and which keeps 
the implementation details out of the way.

Stefan

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