Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #10747
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!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.004 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'thread,': 0.04; 'function,': 0.07; 'interpreter': 0.07; 'python': 0.08; 'declarations': 0.09; 'difference,': 0.09; 'globals': 0.09; 'namespace': 0.09; 'variables,': 0.09; 'programmer': 0.11; 'confusing.': 0.16; "else's": 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'lookup': 0.16; 'names;': 0.16; 'subject:Early': 0.16; 'argument': 0.16; 'looked': 0.16; 'received:209.85.210.174': 0.19; 'received:mail- iy0-f174.google.com': 0.19; 'unlikely': 0.23; 'testing': 0.25; 'function': 0.26; 'message-id:@mail.gmail.com': 0.28; 'bound': 0.29; 'code,': 0.29; 'example': 0.30; 'module': 0.30; 'binding': 0.30; 'yet': 0.30; 'lines': 0.31; 'chris': 0.32; 'done': 0.33; 'anyone': 0.33; 'to:addr:python-list': 0.34; 'there': 0.34; 'someone': 0.34; 'things': 0.34; 'all.': 0.35; '(not': 0.35; 'here,': 0.35; 'uses': 0.35; 'define': 0.35; 'regular': 0.36; 'bother': 0.37; 'thread': 0.37; 'some': 0.37; 'but': 0.37; 'received:google.com': 0.38; 'received:209.85': 0.38; 'something': 0.38; 'should': 0.39; 'flexibility': 0.39; 'allows': 0.39; "there's": 0.39; 'to:addr:python.org': 0.39; 'received:209': 0.40; 'did': 0.40; 'power': 0.62; 'perfect': 0.63; 'huge': 0.64; 'ever': 0.65; 'here': 0.66; 'believe': 0.66; 'due': 0.66; 'realm': 0.84; 'seldom': 0.84; 'ultimate': 0.96 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=saHawTz/zcYQPHMo1UjcMn3UXi7eqZHM4M0+0LvYsGc=; b=SlZ53l39iUHGGbwLs/eRyaKddrcP/T7uZavDEOcj4sOJgixoZkOl5txjHpP5FNooYs +TTV5E/hB9jGppvV5iN6VZ1yS8DI0IPY7YxIwI9BIHWh1o2xnVDDe/mwEIaWp7Miy9G9 Zr0TqvWfBLj/xRrh3nmj9G2R/KQyWi0MYL6HQ= |
| MIME-Version | 1.0 |
| Date | Tue, 2 Aug 2011 17:55:30 +0100 |
| Subject | Early binding as an option |
| 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.1788.1312304133.1164.python-list@python.org> (permalink) |
| Lines | 31 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1312304133 news.xs4all.nl 23835 [2001:888:2000:d::a6]:43359 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:10747 |
Show key headers only | View raw
As I understand it, Python exclusively late-binds names; when you define a function, nothing is ever pre-bound. This allows a huge amount of flexibility (letting you "reach into" someone else's function and change its behaviour), but it's flexibility that most programs use seldom if at all. First off: Is there any way to request/cause some names to be bound early? and secondly, should there be? Argument against: Late binding is a Good Thing, and having some things bound early would be confusing. Argument in favour: Efficiency is also a Good Thing, and with staples like 'len', it's unlikely anyone will want to change them - yet the interpreter still has to do a namespace lookup every time. I would want the end programmer to have the ultimate power here (not the module designer). Something along the lines of: This global name will never change, so don't bother looking it up every time. As an example of this difference, Pike uses early binding for some things; when I did the perfect numbers testing in the other thread (discussion thread, not thread of execution!), Pike performed significantly better; I believe this is in part due to the formal declarations of variables, and the consequential simplification of local code, although since there are no globals being looked up here, there's little to be gained from those. Is this the realm of JIT compilation, or can it be done in regular CPython? Chris Angelico
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Early binding as an option Chris Angelico <rosuav@gmail.com> - 2011-08-02 17:55 +0100 Re: Early binding as an option Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2011-08-02 21:02 +0200
csiph-web