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


Groups > comp.lang.python > #47791

Re: "Don't rebind built-in names*" - it confuses readers

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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 UNSURE 0.294
X-Spam-Level **
X-Spam-Evidence '*H*': 0.60; '*S*': 0.19; 'example:': 0.03; 'def': 0.12; 'confuse': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'wrote:': 0.18; "i've": 0.25; 'second': 0.26; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'that.': 0.31; 'could': 0.34; 'received:google.com': 0.35; 'there': 0.35; 'done': 0.36; 'should': 0.36; 'two': 0.37; 'performance': 0.37; 'needed': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'first': 0.61; 'such': 0.63; 'here)': 0.84; 'is!': 0.84; 'stability': 0.84; 'rusi': 0.91; 'subject:Don': 0.91; 'whereas': 0.91; '2013': 0.98
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:to :content-type; bh=oMVIste1Czs6feXnkMBlnYb/1VNeQC1BfL1stx8RaxU=; b=HHmHvdjprJqLQM8+Ik5ZKhY/19f9OKSBXIWrB//FfLas58YeC9Y82lEt/sVRNet/tJ RVhrIrR8slFFlc0z3H5eDWQjFc3k7My/6pvd6vBzn7xHCr5FqcQ+IyHb8BAMV7pvRjt/ LQanX8TSaX2sz5792AWSxIjBQBbg4VjKf0YtfKHqd4fErMdEulITwDNyzlqvJ8Cj/VjU 8kKjDgC9dzGCmBfPy+kavV/RZuIo59r3hWIQKCM9vQyszn882H/kfpJOFbw4NwuQzsUb IXn2s10Bi8VDBxfXRsjB5/gOfzkumDS55dP6zlttuxoVodnzpuxzT9t65xj8kXufvu+y e5TQ==
MIME-Version 1.0
X-Received by 10.52.117.16 with SMTP id ka16mr6270186vdb.43.1370935226429; Tue, 11 Jun 2013 00:20:26 -0700 (PDT)
In-Reply-To <c4d6d80f-291e-43bc-b75e-ba8eb9bfee3a@li6g2000pbb.googlegroups.com>
References <mailman.3001.1370909708.3114.python-list@python.org> <dffd70ad-4e9a-45cd-914b-7f1388ded5a2@a9g2000pbq.googlegroups.com> <51b69332$0$29997$c3e8da3$5496439d@news.astraweb.com> <c4d6d80f-291e-43bc-b75e-ba8eb9bfee3a@li6g2000pbb.googlegroups.com>
Date Tue, 11 Jun 2013 17:20:26 +1000
Subject Re: "Don't rebind built-in names*" - it confuses readers
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-Mailman-Approved-At Wed, 12 Jun 2013 14:26:58 +0200
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 <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.3097.1371040064.3114.python-list@python.org> (permalink)
Lines 30
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1371040064 news.xs4all.nl 15982 [2001:888:2000:d::a6]:51451
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:47791

Show key headers only | View raw


On Tue, Jun 11, 2013 at 1:30 PM, rusi <rustompmody@gmail.com> wrote:
> Or by example:
>
> def foo(x)...
> def bar(x,y)...
> there is no reason to confuse the two xes.
>
> Whereas
>
> x = ...
> def foo(x)...
> Now there is!
>
> The first should be encouraged, the second discouraged.

Again, there can be good reason for it, such as snapshotting globals:

qwer=123
def asdf(qwer=qwer):
	print("qwer",qwer)

asdf()
qwer=234
asdf()

Done for performance (avoiding lookups), could also be done for
stability (as depicted here) though I've never seen it needed for
that.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

"Don't rebind built-in names*" - it confuses readers Terry Jan Reedy <tjreedy@udel.edu> - 2013-06-10 20:14 -0400
  Re: "Don't rebind built-in names*" - it confuses readers rusi <rustompmody@gmail.com> - 2013-06-10 19:36 -0700
    Re: "Don't rebind built-in names*" - it confuses readers Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-11 03:02 +0000
      Re: "Don't rebind built-in names*" - it confuses readers rusi <rustompmody@gmail.com> - 2013-06-10 20:30 -0700
        Re: "Don't rebind built-in names*" - it confuses readers Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-11 05:52 +0000
        Re: "Don't rebind built-in names*" - it confuses readers Chris Angelico <rosuav@gmail.com> - 2013-06-11 17:20 +1000
      Re: "Don't rebind built-in names*" - it confuses readers Chris Angelico <rosuav@gmail.com> - 2013-06-11 13:57 +1000
      Re: "Don't rebind built-in names*" - it confuses readers Serhiy Storchaka <storchaka@gmail.com> - 2013-06-11 18:55 +0300
      Re: "Don't rebind built-in names*" - it confuses readers Mark Janssen <dreamingforward@gmail.com> - 2013-06-12 17:04 -0700
        Re: "Don't rebind built-in names*" - it confuses readers Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-13 01:01 +0000
      Re: "Don't rebind built-in names*" - it confuses readers Chris Angelico <rosuav@gmail.com> - 2013-06-13 10:08 +1000
        Re: "Don't rebind built-in names*" - it confuses readers Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-13 01:08 +0000
          Re: "Don't rebind built-in names*" - it confuses readers Chris Angelico <rosuav@gmail.com> - 2013-06-13 11:30 +1000
      Re: "Don't rebind built-in names*" - it confuses readers Skip Montanaro <skip@pobox.com> - 2013-06-12 19:18 -0500
      Re: "Don't rebind built-in names*" - it confuses readers Chris Angelico <rosuav@gmail.com> - 2013-06-13 10:33 +1000
      Re: "Don't rebind built-in names*" - it confuses readers Ethan Furman <ethan@stoneleaf.us> - 2013-06-12 17:30 -0700
  Re: "Don't rebind built-in names*" - it confuses readers Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-11 02:56 +0000
    Re: "Don't rebind built-in names*" - it confuses readers Terry Jan Reedy <tjreedy@udel.edu> - 2013-06-11 02:06 -0400
    Re: "Don't rebind built-in names*" - it confuses readers Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-11 08:22 -0700
      Re: "Don't rebind built-in names*" - it confuses readers Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-11 16:59 +0000
      Re: "Don't rebind built-in names*" - it confuses readers Chris Angelico <rosuav@gmail.com> - 2013-06-12 03:32 +1000

csiph-web