Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #82304
| Path | csiph.com!usenet.pasdenom.info!news.franciliens.net!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-1.proxad.net!ecngs!feeder2.ecngs.de!81.171.88.16.MISMATCH!hq-usenetpeers.eweka.nl!hq-usenetpeers.eweka.nl!bcyclone02.am1.xlned.com!bcyclone02.am1.xlned.com!newsfeed.xs4all.nl!newsfeed4.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.02; 'argument': 0.05; 'explicitly': 0.05; 'subject:Python': 0.06; 'class,': 0.07; 'string': 0.09; 'attributes': 0.09; 'constructor': 0.09; 'exist,': 0.09; 'function,': 0.09; 'instances.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:using': 0.09; 'jan': 0.12; 'added.': 0.16; 'attributes,': 0.16; 'dict': 0.16; 'downside': 0.16; 'evaluates': 0.16; 'exist.': 0.16; 'ides': 0.16; 'iterable': 0.16; 'itertools': 0.16; 'likewise': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'value=none,': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'module': 0.19; 'value.': 0.19; 'written': 0.21; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'alternate': 0.24; 'apply.': 0.24; 'versions': 0.24; 'mention': 0.26; 'recognized': 0.26; 'values': 0.27; 'header:X-Complaints- To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'am,': 0.29; 'code': 0.31; 'doc': 0.31; 'existence': 0.31; 'keys': 0.31; 'lists': 0.32; 'probably': 0.32; 'another': 0.32; 'core': 0.34; 'problem': 0.35; 'classes': 0.35; 'equal': 0.35; 'but': 0.35; 'add': 0.35; 'there': 0.35; 'idle': 0.36; 'instances': 0.36; 'module.': 0.36; 'e.g.': 0.38; 'to:addr:python-list': 0.38; 'rather': 0.38; 'does': 0.39; 'though,': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'received:org': 0.40; 'chain': 0.60; 'ian': 0.60; 'new': 0.61; 'simply': 0.61; 'further': 0.61; 'making': 0.63; 'show': 0.63; 'taking': 0.65; 'believe': 0.68; 'increase': 0.74; 'completion': 0.78; 'dict.': 0.84; '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: Python Iterables struggling using map() built-in |
| Date | Wed, 10 Dec 2014 12:48:06 -0500 |
| References | <004e01d01173$e1641c10$a42c5430$@gmail.com> <m61roh$i5m$1@ger.gmane.org> <CALwzid=79=i3Sez3fQYV7xU2bEAL4_ohPqxhuYj59Y5ihXk1Zg@mail.gmail.com> <mailman.16685.1417976998.18130.python-list@python.org> <5484e3d8$0$13013$c3e8da3$5496439d@news.astraweb.com> <roy-3F4751.19122007122014@news.panix.com> <54866372$0$12991$c3e8da3$5496439d@news.astraweb.com> <m65vrc$j0t$1@ger.gmane.org> <mailman.16776.1418155635.18130.python-list@python.org> <54878f8a$0$13010$c3e8da3$5496439d@news.astraweb.com> <roy-0FD505.21442409122014@news.panix.com> <54881159$0$2817$c3e8da3$76491128@news.astraweb.com> <CALwzidnU9nLTTTzOqg+MxeUbDixjEx_sSi=Tsy4MPaFuy--HUA@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| 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:24.0) Gecko/20100101 Thunderbird/24.6.0 |
| In-Reply-To | <CALwzidnU9nLTTTzOqg+MxeUbDixjEx_sSi=Tsy4MPaFuy--HUA@mail.gmail.com> |
| 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.16823.1418233709.18130.python-list@python.org> (permalink) |
| Lines | 52 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1418233709 news.xs4all.nl 2856 [2001:888:2000:d::a6]:48877 |
| X-Complaints-To | abuse@xs4all.nl |
| X-Received-Body-CRC | 2696039374 |
| X-Received-Bytes | 6313 |
| Xref | csiph.com comp.lang.python:82304 |
Show key headers only | View raw
On 12/10/2014 11:46 AM, Ian Kelly wrote: > I don't particularly have a problem with functions having attributes, > e.g. I think itertools.chain.from_iterable is just peachy. There is a > downside though, which is that making those functions attributes of > another function rather than of the module Itertools.chain is a class, not a function. Chain.from_iterable is an *alternate constructor* for instances of the class, just as dict.fromkeys is an alternate constructor for dict instances. It is true that if itertools were written in python, chain and the other classes would likely be written as generator functions, so tha analogy would not apply. > defeats the dir() function for that module. And it is also true that dir(__builtins__) does not show dict.fromkeys. > Likewise the generated help for the help() function, > unless care is taken to explicitly mention the existence of those > functions in either the doc string for the module help(it.chain) lists | from_iterable(...) from builtins.type | chain.from_iterable(iterable) --> chain object | | Alternate chain() contructor taking a single iterable argument | that evaluates lazily. help(dict) | fromkeys(iterable, value=None, /) from builtins.type | Returns a new dict with keys from iterable and values equal to value. > Thirdly, IDEs with code completion features may simply fail to > notice that these alternate versions of the function exist. I don't know what you mean here. In Idle >>> it.chain. --> completion box with from_iterable >>> dict. --> completion box that includes fromkeys None of the above is to say that alternate constructors for classed are not a bit awkward. I believe this was recognized when dict.fromkeys was added. But it was considered less awkward than the alternatives: 1. do not add the functionality; 2. further overload the main (__init__) constructor; 3. add a independent function. Anyway, they exist, are an accepted pattern among core devs, and will probably increase in number. -- Terry Jan Reedy
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: Python Iterables struggling using map() built-in Chris Angelico <rosuav@gmail.com> - 2014-12-08 05:29 +1100
Re: Python Iterables struggling using map() built-in Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-12-08 10:33 +1100
Re: Python Iterables struggling using map() built-in Chris Angelico <rosuav@gmail.com> - 2014-12-08 10:50 +1100
Re: Python Iterables struggling using map() built-in Roy Smith <roy@panix.com> - 2014-12-07 19:27 -0500
Re: Python Iterables struggling using map() built-in Chris Angelico <rosuav@gmail.com> - 2014-12-08 11:35 +1100
Re: Python Iterables struggling using map() built-in Steven D'Aprano <steve@pearwood.info> - 2014-12-08 09:40 +0000
Re: Python Iterables struggling using map() built-in Chris Angelico <rosuav@gmail.com> - 2014-12-08 20:50 +1100
Re: Python Iterables struggling using map() built-in Roy Smith <roy@panix.com> - 2014-12-08 19:02 -0500
Re: Python Iterables struggling using map() built-in Roy Smith <roy@panix.com> - 2014-12-07 19:12 -0500
Re: Python Iterables struggling using map() built-in Chris Angelico <rosuav@gmail.com> - 2014-12-08 11:34 +1100
Re: Python Iterables struggling using map() built-in Roy Smith <roy@panix.com> - 2014-12-07 19:45 -0500
Re: Python Iterables struggling using map() built-in Chris Angelico <rosuav@gmail.com> - 2014-12-08 12:00 +1100
Re: Python Iterables struggling using map() built-in MRAB <python@mrabarnett.plus.com> - 2014-12-08 03:09 +0000
Re: Python Iterables struggling using map() built-in Terry Reedy <tjreedy@udel.edu> - 2014-12-07 19:38 -0500
Re: Python Iterables struggling using map() built-in Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-12-08 18:06 +1300
Re: Python Iterables struggling using map() built-in Ned Batchelder <ned@nedbatchelder.com> - 2014-12-07 20:06 -0500
Re: Python Iterables struggling using map() built-in Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-12-09 13:50 +1100
Re: Python Iterables struggling using map() built-in Terry Reedy <tjreedy@udel.edu> - 2014-12-09 00:03 -0500
Re: Python Iterables struggling using map() built-in Steven D'Aprano <steve@pearwood.info> - 2014-12-09 06:40 +0000
Re: Python Iterables struggling using map() built-in Terry Reedy <tjreedy@udel.edu> - 2014-12-09 15:06 -0500
Re: Python Iterables struggling using map() built-in Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-12-10 11:10 +1100
Re: Python Iterables struggling using map() built-in Chris Angelico <rosuav@gmail.com> - 2014-12-10 11:20 +1100
Re: Python Iterables struggling using map() built-in Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-12-10 00:24 +0000
Re: Python Iterables struggling using map() built-in Roy Smith <roy@panix.com> - 2014-12-09 21:44 -0500
Re: Python Iterables struggling using map() built-in Steven D'Aprano <steve@pearwood.info> - 2014-12-10 09:24 +0000
Re: Python Iterables struggling using map() built-in Chris Angelico <rosuav@gmail.com> - 2014-12-10 20:32 +1100
Re: Python Iterables struggling using map() built-in Marko Rauhamaa <marko@pacujo.net> - 2014-12-10 12:58 +0200
Re: Python Iterables struggling using map() built-in Ian Kelly <ian.g.kelly@gmail.com> - 2014-12-10 09:46 -0700
Re: Python Iterables struggling using map() built-in Steven D'Aprano <steve@pearwood.info> - 2014-12-11 04:01 +0000
Re: Python Iterables struggling using map() built-in Ian Kelly <ian.g.kelly@gmail.com> - 2014-12-11 15:00 -0700
Re: Python Iterables struggling using map() built-in Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-12-12 10:28 +1100
Re: Python Iterables struggling using map() built-in Ian Kelly <ian.g.kelly@gmail.com> - 2014-12-11 16:57 -0700
Re: Python Iterables struggling using map() built-in Roy Smith <roy@panix.com> - 2014-12-11 20:55 -0500
Re: Python Iterables struggling using map() built-in Ian Kelly <ian.g.kelly@gmail.com> - 2014-12-12 00:36 -0700
Re: Python Iterables struggling using map() built-in Chris Angelico <rosuav@gmail.com> - 2014-12-12 11:44 +1100
Re: Python Iterables struggling using map() built-in Terry Reedy <tjreedy@udel.edu> - 2014-12-10 12:48 -0500
Re: Python Iterables struggling using map() built-in Ian Kelly <ian.g.kelly@gmail.com> - 2014-12-10 13:32 -0700
Re: Python Iterables struggling using map() built-in Terry Reedy <tjreedy@udel.edu> - 2014-12-10 23:17 -0500
Re: Python Iterables struggling using map() built-in Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-12-08 18:00 +1300
csiph-web