Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #4570
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <dan.kluev@gmail.com> |
| 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; 'python,': 0.01; 'subject:module': 0.04; 'wed,': 0.04; 'foo': 0.09; '>>>': 0.12; 'def': 0.13; 'am,': 0.14; 'wrote:': 0.14; 'except:': 0.16; 'name):': 0.16; 'simulate': 0.16; 'subject:directly': 0.16; 'subject:those': 0.16; 'symbolic': 0.16; 'object,': 0.19; 'cc:no real name:2**0': 0.20; 'cc:2**0': 0.20; 'header:In-Reply-To:1': 0.22; 'cc:addr:python-list': 0.22; 'received:209.85.214.174': 0.23; 'received:mail-iw0-f174.google.com': 0.23; 'skip:_ 20': 0.24; 'pointing': 0.25; 'message-id:@mail.gmail.com': 0.28; 'subject:?': 0.29; 'daniel': 0.29; 'class': 0.29; 'cc:addr:python.org': 0.31; 'points': 0.31; "'a')": 0.31; 'reference': 0.34; 'there': 0.35; 'try:': 0.35; 'skip:o 20': 0.37; 'received:209.85': 0.37; 'received:google.com': 0.38; 'received:209.85.214': 0.39; 'skip:s 30': 0.39; 'could': 0.39; 'received:209': 0.39; 'i.e.': 0.40; 'header:Received:5': 0.40; 'best': 0.60; '2011': 0.62; 'p.s.': 0.65; 'subject:Why': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=N73/nqIH+glo13RFJa3JETMBB+pLVlyFqXdN/fcBAQ8=; b=oDKv5VUJcP23JnoAaxdxCcmJIQSlH7d0bZstGsx1hVq5twXDslIID3lks4eZQta0Dr 2zNp8gSf36osompmrTH7Ieg2lK2V95I7dOErBLC28AaTdlmIX/vk8xjPK6193VGrLWkp pKFeNHPEnoK262CUTAmArJWWQYiKR3YgG/M1U= |
| DomainKey-Signature | a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=h5YxCj3GosnV8S1sg2IHBtxmVeXg01aZ1O9lPKUFMI6ZUw5MFjREi5xWO4ff0bxl9W 5MFCMsVu85+MvYc1Dspx5UvCAtf6Ofy1qV5O3hKV3w5PfRW1u5Hb3hxWhLZdRFljzqKs qI1SaeEZAgIfchRj1cjQUVleZ4McmoqKYsZPQ= |
| MIME-Version | 1.0 |
| In-Reply-To | <5299438d-611f-4a63-b1d8-4abe039ad5d4@k3g2000prl.googlegroups.com> |
| References | <d8d1d20e-2edd-49e5-917c-f338ef35006f@l18g2000yql.googlegroups.com> <vTWvp.23964$vC5.14171@newsfe01.iad> <b2d938e7-7df3-461b-a952-47a81000a335@26g2000yqa.googlegroups.com> <5299438d-611f-4a63-b1d8-4abe039ad5d4@k3g2000prl.googlegroups.com> |
| Date | Wed, 4 May 2011 06:55:04 +1100 |
| Subject | Re: Why do directly imported variables behave differently than those attached to imported module? |
| From | Daniel Kluev <dan.kluev@gmail.com> |
| To | Dun Peal <dunpealer@gmail.com> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Cc | python-list@python.org |
| 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.1119.1304452508.9059.python-list@python.org> (permalink) |
| Lines | 37 |
| NNTP-Posting-Host | 82.94.164.166 |
| X-Trace | 1304452508 news.xs4all.nl 41114 [::ffff:82.94.164.166]:45143 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:4570 |
Show key headers only | View raw
On Wed, May 4, 2011 at 6:23 AM, Dun Peal <dunpealer@gmail.com> wrote:
> P.S. now I have to ask: is there a symbolic reference in Python, i.e.
> a name foo that points to "whatever bar.baz is pointing at"?
Well, you could easily simulate that with proxy object,
class SymbolicReference(object):
def __init__(self, ns, name):
self.__ns = ns
self.__name = name
def __get(self):
return self.__ns[self.__name]
def __getattribute__(self, attr):
try:
return object.__getattribute__(self, attr)
except:
return self.__get().__getattribute__(attr)
def __repr__(self):
return self.__get().__repr__()
def __str__(self):
return self.__get().__str__()
>>> a = 1
>>> b = SymbolicReference(globals(), 'a')
>>> b
1
>>> a = 10
>>> b
10
--
With best regards,
Daniel Kluev
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar
Why do directly imported variables behave differently than those attached to imported module? Dun Peal <dunpealer@gmail.com> - 2011-05-03 09:31 -0700
Re: Why do directly imported variables behave differently than those attached to imported module? Chris Rebert <clp2@rebertia.com> - 2011-05-03 09:57 -0700
Re: Why do directly imported variables behave differently than those attached to imported module? Daniel Kluev <dan.kluev@gmail.com> - 2011-05-04 03:57 +1100
Re: Why do directly imported variables behave differently than those attached to imported module? Mel <mwilson@the-wire.com> - 2011-05-03 13:00 -0400
Re: Why do directly imported variables behave differently than those attached to imported module? Terry Reedy <tjreedy@udel.edu> - 2011-05-03 13:13 -0400
Re: Why do directly imported variables behave differently than those attached to imported module? harrismh777 <harrismh777@charter.net> - 2011-05-03 12:24 -0500
Re: Why do directly imported variables behave differently than those attached to imported module? Dun Peal <dunpealer@gmail.com> - 2011-05-03 11:51 -0700
Re: Why do directly imported variables behave differently than those attached to imported module? Dun Peal <dunpealer@gmail.com> - 2011-05-03 12:23 -0700
Re: Why do directly imported variables behave differently than those attached to imported module? Daniel Kluev <dan.kluev@gmail.com> - 2011-05-04 06:55 +1100
Re: Why do directly imported variables behave differently than those attached to imported module? Chris Angelico <rosuav@gmail.com> - 2011-05-04 07:47 +1000
Re: Why do directly imported variables behave differently than those attached to imported module? Duncan Booth <duncan.booth@invalid.invalid> - 2011-05-04 08:44 +0000
Re: Why do directly imported variables behave differently than those attached to imported module? Chris Rebert <clp2@rebertia.com> - 2011-05-03 15:11 -0700
csiph-web