Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!novso.com!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: 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; 'example:': 0.03; 'programmer': 0.03; 'source,': 0.04; 'cpython': 0.05; 'explicitly': 0.05; 'subject:Python': 0.06; 'referring': 0.07; 'string': 0.09; '"""add': 0.09; 'comments?': 0.09; 'feature.': 0.09; 'function,': 0.09; 'identifier': 0.09; 'literal': 0.09; 'non-text': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'def': 0.12; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'instances,': 0.16; 'sources.': 0.16; 'language': 0.16; 'wrote:': 0.18; 'first.': 0.19; 'widget': 0.19; 'cc:addr:python.org': 0.22; 'tells': 0.24; 'mon,': 0.24; 'cc:2**0': 0.24; 'source': 0.25; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'generally': 0.29; 'thus': 0.29; 'message- id:@mail.gmail.com': 0.30; 'code': 0.31; 'globally': 0.31; "they'll": 0.31; 'text': 0.33; 'open': 0.33; 'assistance,': 0.33; 'comment': 0.34; 'subject: (': 0.35; 'common': 0.35; 'problem.': 0.35; 'something': 0.35; 'editor': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'accessing': 0.36; 'useful': 0.36; 'should': 0.36; 'subject:New': 0.37; 'project': 0.37; 'implement': 0.38; 'handle': 0.38; 'files': 0.38; 'pm,': 0.38; 'sure': 0.39; 'how': 0.40; 'even': 0.60; 'remove': 0.60; 'such': 0.63; 'more': 0.64; 'life': 0.66; 'here': 0.66; '20,': 0.68; '2015': 0.84; 'dozens': 0.84; 'easier!': 0.84; 'grew': 0.84; 'holes': 0.84; 'informative,': 0.84; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=cEIUHTGbJU923GWOgAykQlFxeHJARiz1P2Sjykpn4FY=; b=hHs++XaC6PdUoBb/fPIek7+e39GoQnKnwCecvYunO++vgtrd7IgFJZdNm8mT5KHhjy jK2tweGonn6Ys+DBn1PVWVya32OhwqijFlzKzUw2MxrvsBCRQFefwxVwCtYIG58hl4vI z+Ek3BtmjM+BeX6hGj0APc+pb0tf/HOvVYzYkNIHU9vwQ5k07YwedeupK2OH6YWTOUug yzgvQR2SwQHjEueT1egO2a5/J7ovANmXRmTzi8fp7F49CsqCcJpK4mH4nIp9QtVdLrVE ZpwYtCA1tr4+dKBSz0ZGC1Agucg3PV8bQ1Y7LonmbywLVuIpYIEsfRfZzBqzwqXy/d80 flRQ== MIME-Version: 1.0 X-Received: by 10.50.114.35 with SMTP id jd3mr14230972igb.14.1429501448418; Sun, 19 Apr 2015 20:44:08 -0700 (PDT) In-Reply-To: <17ed0132-89d5-4b45-81b5-b61328a21198@googlegroups.com> References: <9fc57fc9-0399-4ff3-882a-d041f02827d8@googlegroups.com> <6580b5d5-92f5-4bfa-b1d0-889c69fe82bb@googlegroups.com> <7tMYw.252071$SO1.39320@fx43.am4> <7413a8e7-b580-4b2f-84bc-dd13da2d36ba@googlegroups.com> <5533eb85$0$12992$c3e8da3$5496439d@news.astraweb.com> <16d59891-6e28-4256-870a-903bb75aa953@googlegroups.com> <17ed0132-89d5-4b45-81b5-b61328a21198@googlegroups.com> Date: Mon, 20 Apr 2015 13:44:08 +1000 Subject: Re: New to Python - block grouping (spaces) From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 45 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1429501451 news.xs4all.nl 2893 [2001:888:2000:d::a6]:43234 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:89197 On Mon, Apr 20, 2015 at 1:28 PM, Rustom Mody wrote: >> If you have a ten-file project that's identifying a key function >> globally as 'f', then you already have a problem. If your names are >> more useful and informative, a global search-and-replace will do the >> job. > > Are you sure your global search-and-replace will do a proper job inside > strings and comments? Yep! Any occurrence inside a string literal or comment is generally going to be referring to the same function, and thus should be renamed. Can your system handle _that_? Example: def add_grab(widget): """Add a widget to the grabbed widgets""" def remove_grab(widget): """Undo the effect of add_grab() on a given widget""" # Note that multiple add_grab() calls will add multiple instances, # so we remove only the first. Every occurrence of add_grab here is referring to the function. If you do a global search-and-replace, they'll be caught automatically. With your non-text magic, you'd need to explicitly implement this as a feature. Text files make life easier! >> What's your point, though? > > Point? > > Nnotions like identifier (and dozens of others) are straightforwardly > present and available inside the python implementation. > However the language implementation is a hard-n-high silo > For the programmer accessing the language through an editor these notions are > not available unless hi-power explosives are used to punch holes in the silo > -- eg open Cpython sources. Would it help if Python grew a function like Pike's Function.defined(), which tells you exactly where, even in C source, something was defined? I don't honestly see that looking in the CPython source is such a common need that it begs for assistance, and I definitely don't see how a non-text source code format would improve on it. Feel like elaborating? ChrisA