Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #96385
| Path | csiph.com!goblin1!goblin.stu.neva.ru!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!nzpost1.xs4all.net!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; 'subject:Python': 0.05; 'compiler': 0.05; 'from:addr:yahoo.co.uk': 0.05; 'correct.': 0.07; 'only,': 0.07; 'responding': 0.07; '"if': 0.09; 'already.': 0.09; 'global,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'specifying': 0.09; 'bug': 0.10; 'python': 0.10; 'def': 0.13; 'missed': 0.15; 'applies': 0.15; 'argument': 0.15; 'explicitly': 0.15; 'thu,': 0.15; '"del"': 0.16; '4:25': 0.16; 'assignment.': 0.16; 'closures': 0.16; "compiler's": 0.16; 'declaration': 0.16; 'eval': 0.16; 'idle.': 0.16; 'iirc': 0.16; 'local.': 0.16; 'maintainer': 0.16; 'namespace.': 0.16; 'programmers,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'recognise': 0.16; 'reedy': 0.16; 'rigid': 0.16; 'stuff)': 0.16; 'tabs': 0.16; 'wrote:': 0.16; 'looked': 0.16; 'variable': 0.18; 'language': 0.19; '>>>': 0.20; 'library': 0.20; '2015': 0.20; 'otherwise,': 0.20; 'fairly': 0.22; 'exec': 0.22; 'function,': 0.22; 'lawrence': 0.22; 'parser': 0.22; 'sep': 0.22; 'am,': 0.23; 'seems': 0.23; 'import': 0.24; 'header:In-Reply-To:1': 0.24; 'module': 0.25; 'header:User-Agent:1': 0.26; 'developers': 0.26; 'header:X-Complaints-To:1': 0.26; 'fri,': 0.27; 'order.': 0.27; 'function': 0.28; '(although': 0.29; 'declared': 0.29; 'programmers': 0.30; 'guess': 0.31; 'rules': 0.31; 'another': 0.32; 'core': 0.32; 'knows': 0.32; 'language.': 0.32; "d'aprano": 0.33; 'doubt': 0.33; 'steven': 0.33; 'except': 0.34; 'so,': 0.35; 'trouble': 0.35; 'functions.': 0.35; 'mix': 0.35; 'star': 0.35; 'something': 0.35; 'according': 0.36; 'list,': 0.36; 'there': 0.36; '(and': 0.36; 'assigned': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'received:org': 0.37; 'one,': 0.37; 'things': 0.38; 'doing': 0.38; 'senior': 0.39; 'to:addr:python.org': 0.40; 'mark': 0.40; 'decision': 0.61; 'spam.': 0.61; 'here.': 0.62; 'charset:windows-1252': 0.62; 'genuine': 0.63; 'more': 0.63; 'within': 0.64; 'our': 0.64; 'between': 0.65; 'therefore': 0.67; 'counts': 0.81; 'gain': 0.82; 'lastly,': 0.84; 'presumably': 0.84; 'pythonistas,': 0.84; 'rue': 0.84; 'simple:': 0.84; 'specialised': 0.84; 'worth,': 0.84; 'mean.': 0.91 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
| Subject | Re: Python handles globals badly. |
| Date | Sat, 12 Sep 2015 03:51:17 +0100 |
| References | <c3363$547e74fe$5419aafe$24179@news.ziggo.nl> <cd7b7ffa-a217-4b62-bad2-9095b33a2bb6@googlegroups.com> <mailman.344.1441931751.8327.python-list@python.org> <55f293da$0$1640$c3e8da3$5496439d@news.astraweb.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=windows-1252; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | 195.147.66.69 |
| User-Agent | Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 |
| In-Reply-To | <55f293da$0$1640$c3e8da3$5496439d@news.astraweb.com> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| 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.393.1442026292.8327.python-list@python.org> (permalink) |
| Lines | 90 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1442026292 news.xs4all.nl 23739 [2001:888:2000:d::a6]:51276 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:96385 |
Show key headers only | View raw
On 11/09/2015 09:42, Steven D'Aprano wrote:
> On Fri, 11 Sep 2015 10:35 am, Ian Kelly wrote:
>
>> On Thu, Sep 10, 2015 at 4:25 PM, <tdev@freenet.de> wrote:
> [...]
>>> So the compiler knows the distiction between global and local already.
>>
>> As we've said before, it doesn't. The compiler's current rules are
>> fairly simple:
>>
>> 1) If it's in the function's argument list, it's an argument (and
>> therefore local).
>> 2) If it's explicitly declared global, then it's global.
>> 3) If it's never assigned within the function, then it's global.
>
> Almost. If it's never assigned within the function, then it is looked up
> according to the non-local scoping rules:
>
> - closures and enclosing functions (if any);
> - globals;
> - builtins;
>
> in that order.
>
>
>> 4) Otherwise, it's local.
>
> "Otherwise" meaning "if it is assigned to", except that "del" counts as an
> assignment. That is:
>
> def spam():
> del x
>
> makes x a local variable inside the function spam.
>
>
> There's also a bunch of specialised and complicated rules for what happens
> if you make a star import ("from module import *") inside a function, or
> call eval or exec without specifying a namespace. Both of these things are
> now illegal in Python 3.
>
> And lastly, in Python 3 only, there is also a nonlocal declaration which
> works like global except it applies only to closures and enclosing
> functions.
>
>
>>> Another proof about identation:
>>> The parser can recognise identation with tabs and spaces.
>>
>> You can use tabs *or* spaces.
>
> In Python 3.
>
> In Python 2, you can mix tabs *and* spaces, and Python will try to guess
> what you mean. This causes more trouble than it is worth, and is removed in
> Python 3.
>
>
> [...]
>> I really doubt that you're going to gain any traction with this one,
>> because the decision that was made with Python 3 was to make the
>> compiler *more* rigid about not mixing tabs and spaces, not less.
>
> Correct.
>
> [...]
>>> Who is responding or has responded?
>>> Extreme Programmers, Python-Hardliner, Python-Evangelists, ... .
>>> Presumably no core Python Programmers (wrting compiler and standard
>>> library stuff)
>>
>> Ad hominem.
>
> For the record, I am the author of the statistics module in Python 3.4, and
> Terry Reedy is the very active maintainer of IDLE. If I have missed anyone,
> my apologies. So, yes, there are core developers here.
>
> (Although not any of the senior core devs, as far as I know.)
>
IIRC Serhiy Storchaka pops in occasionally, as on the one genuine report
from the RUE about the FSR. Slight aside, I swear blind that Serhiy
never sleeps as he always seems to be doing something on the bug tracker.
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: Python handles globals badly. tdev@freenet.de - 2015-09-10 15:25 -0700
Re: Python handles globals badly. Emile van Sebille <emile@fenx.com> - 2015-09-10 15:40 -0700
Re: Python handles globals badly. Ian Kelly <ian.g.kelly@gmail.com> - 2015-09-10 18:35 -0600
Re: Python handles globals badly. Marko Rauhamaa <marko@pacujo.net> - 2015-09-11 07:34 +0300
Re: Python handles globals badly. Chris Angelico <rosuav@gmail.com> - 2015-09-11 14:59 +1000
Re: Python handles globals badly. Marko Rauhamaa <marko@pacujo.net> - 2015-09-11 08:15 +0300
Re: Python handles globals badly. Chris Angelico <rosuav@gmail.com> - 2015-09-11 15:25 +1000
Re: Python handles globals badly. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-09-12 03:43 +0100
Re: Python handles globals badly. Ian Kelly <ian.g.kelly@gmail.com> - 2015-09-10 23:07 -0600
Re: Python handles globals badly. Marko Rauhamaa <marko@pacujo.net> - 2015-09-11 08:27 +0300
Re: Python handles globals badly. Rustom Mody <rustompmody@gmail.com> - 2015-09-11 00:39 -0700
Re: Python handles globals badly. Steven D'Aprano <steve@pearwood.info> - 2015-09-11 18:42 +1000
Re: Python handles globals badly. Chris Angelico <rosuav@gmail.com> - 2015-09-11 19:16 +1000
Re: Python handles globals badly. Ian Kelly <ian.g.kelly@gmail.com> - 2015-09-11 09:03 -0600
Re: Python handles globals badly. Steven D'Aprano <steve@pearwood.info> - 2015-09-12 17:00 +1000
Re: Python handles globals badly. Chris Angelico <rosuav@gmail.com> - 2015-09-12 01:15 +1000
Re: Python handles globals badly. Ian Kelly <ian.g.kelly@gmail.com> - 2015-09-11 09:27 -0600
Re: Python handles globals badly. Chris Angelico <rosuav@gmail.com> - 2015-09-12 01:44 +1000
Re: Python handles globals badly. Ian Kelly <ian.g.kelly@gmail.com> - 2015-09-11 09:49 -0600
Re: Python handles globals badly. Chris Angelico <rosuav@gmail.com> - 2015-09-12 01:55 +1000
Re: Python handles globals badly. random832@fastmail.us - 2015-09-11 11:57 -0400
Re: Python handles globals badly. Rustom Mody <rustompmody@gmail.com> - 2015-09-11 09:08 -0700
Re: Python handles globals badly. Chris Angelico <rosuav@gmail.com> - 2015-09-12 02:04 +1000
Re: Python handles globals badly. Ian Kelly <ian.g.kelly@gmail.com> - 2015-09-11 10:27 -0600
Re: Python handles globals badly. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-09-12 03:51 +0100
Re: Python handles globals badly. MRAB <python@mrabarnett.plus.com> - 2015-09-11 02:17 +0100
Re: Python handles globals badly. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-09-12 03:27 +0100
csiph-web