Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Random832 Newsgroups: comp.lang.python Subject: Re: I'm wrong or Will we fix the ducks limp? Date: Tue, 07 Jun 2016 11:33:40 -0400 Lines: 36 Message-ID: References: <87mvn22veg.fsf@rudin.co.uk> <13108bea-6750-443b-bee8-0532aba8b338@googlegroups.com> <5753c89b$0$1616$c3e8da3$5496439d@news.astraweb.com> <1465148542.2670061.628500777.62F1EFE1@webmail.messagingengine.com> <5754f36b$0$1619$c3e8da3$5496439d@news.astraweb.com> <1465186088.3554819.628831041.19D0DC8D@webmail.messagingengine.com> <575599f4$0$1595$c3e8da3$5496439d@news.astraweb.com> <57569f6a$0$11124$c3e8da3@news.astraweb.com> <5756BED8.2000304@rece.vub.ac.be> <1465313620.1380508.630546953.7F7E755D@webmail.messagingengine.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de jSORiDzttxpfwI8MdXXMvgMwqgAlApAtZ9cGRy94/wSQ== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'guido': 0.05; 'high- level': 0.09; 'obj': 0.09; 'obj,': 0.09; 'operator,': 0.09; 'received:internal': 0.09; 'python': 0.10; 'python.': 0.11; 'def': 0.13; 'dereference': 0.16; 'key):': 0.16; 'low-level': 0.16; 'message-id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:io': 0.16; 'received:messagingengine.com': 0.16; 'received:psf.io': 0.16; 'self.obj': 0.16; 'values:': 0.16; 'wrote:': 0.16; 'pointer': 0.18; 'variable': 0.18; '(not': 0.20; 'suppose': 0.22; 'defined': 0.23; 'references': 0.23; 'header:In-Reply-To:1': 0.24; 'sense': 0.26; 'skip:_ 20': 0.26; 'becomes': 0.30; 'skip:_ 10': 0.32; 'class': 0.33; 'tue,': 0.34; 'could': 0.35; 'something': 0.35; 'there': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'thought': 0.37; 'received:66': 0.38; 'why': 0.39; 'subject:the': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'called': 0.40; 'header :Message-Id:1': 0.61; 'you.': 0.64; 'dangerous': 0.70; 'treat': 0.72; 'announces': 0.84; 'bar)': 0.84; 'experiment': 0.84; 'pardon': 0.84 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=E5KBczy16uPXYYlfB6/4ls8Joyo=; b=FT5Zto FiwZ92O02Z7Fx0rjHFCHnxjFsIsj7kGVwYeNdK4cEgsvLBdovObSYdCxUMK5t7UK 038zUS03ByKDyY2Q8wc7LKDXhguMo5YBKiD2orMT6SiS3DQ4k+D2p0s5W6LNVtL6 rb0T9224DP/caSZ0BDE8ArOKy5UW7ztmr+SzM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=E5KBczy16uPXYYl fB6/4ls8Joyo=; b=eYKhK4a+QpQC9+NR1wr9v+HVCK9Q+U1gUJBkBLqed6LLo9P 20b1r+jR8tiAP4hNYMWFjEg/mIEFAFYe6eltV4N/NX77JrnRMRwJPwqTGgWudQrV tJqWAvYia2g1Ck2+z36i/HDFcIGNsX4x8vE6ykWU0zR7+yTCQR0jecLBoHpQ= X-Sasl-Enc: OMAUUTUjmDPpodhQPPvPuKVilg9H+UcH2TMKLO9JjKmE 1465313620 X-Mailer: MessagingEngine.com Webmail Interface - ajax-7f2506ab In-Reply-To: <5756BED8.2000304@rece.vub.ac.be> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <1465313620.1380508.630546953.7F7E755D@webmail.messagingengine.com> X-Mailman-Original-References: <87mvn22veg.fsf@rudin.co.uk> <13108bea-6750-443b-bee8-0532aba8b338@googlegroups.com> <5753c89b$0$1616$c3e8da3$5496439d@news.astraweb.com> <1465148542.2670061.628500777.62F1EFE1@webmail.messagingengine.com> <5754f36b$0$1619$c3e8da3$5496439d@news.astraweb.com> <1465186088.3554819.628831041.19D0DC8D@webmail.messagingengine.com> <575599f4$0$1595$c3e8da3$5496439d@news.astraweb.com> <57569f6a$0$11124$c3e8da3@news.astraweb.com> <5756BED8.2000304@rece.vub.ac.be> Xref: csiph.com comp.lang.python:109629 On Tue, Jun 7, 2016, at 08:32, Antoon Pardon wrote: > > Here's a thought experiment for you. Suppose in Python 3.6, Guido announces > > that Python will support a form of high-level pointer (not the scary, dangerous > > low-level pointer of C) called "reference". There will be a dereference > > operator, ^, and a "reference to" operator, @. We'll be able to treat > > references as first-class values: > > That makes very little sense in python. Why not? If you prefer, think of it something like: class ItemPtr: def __init__(self, obj, key): self.obj = obj self.key = key def ___setvalue___(self, value): self.obj[self.key] = value def ___getvalue___(self) return self.obj[self.key] @(foo[bar]) returns ItemPtr(foo, bar) @baz where bar is a global variable returns ItemPtr(globals(), 'baz') @quux where quux is local returns a cell object (any local that is used in such an expression becomes a cell variable as with any local that is used in a closure), and the cell type shall have these methods added to it. @(foo.bar) returns AttrPtr(foo, 'bar') where AttrPtr is a similarly defined type. We could even support a kind of "pointer arithmetic" for ItemPtr to list-like containers: def __add__(self, offset): return ItemPtr(self.obj, self.key + offset) def __getitem__(self, offset): return self.obj[self.key + offset]