Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #11002
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!feeder3.cambriumusenet.nl!feeder1.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.84.MISMATCH!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ericsnowcurrently@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; 'attributes': 0.05; 'instance': 0.05; 'suppose': 0.05; 'attribute': 0.07; 'check.': 0.07; 'convention.': 0.07; 'subject:object': 0.07; '__name__': 0.09; 'stored': 0.13; 'class,': 0.15; 'already.': 0.16; 'non-data': 0.16; 'cc:addr :python-list': 0.16; 'wrote:': 0.16; 'cc:no real name:2**0': 0.20; 'trying': 0.21; 'cc:2**0': 0.22; 'header:In-Reply-To:1': 0.22; 'module,': 0.23; 'objects,': 0.23; 'pm,': 0.24; 'aug': 0.24; 'object,': 0.24; 'code': 0.25; 'function': 0.27; 'sat,': 0.28; 'url:mailman': 0.28; 'message-id:@mail.gmail.com': 0.29; 'cc:addr:python.org': 0.30; 'do.': 0.30; 'class': 0.30; 'subject:?': 0.31; 'objects': 0.32; 'url:listinfo': 0.33; 'regardless': 0.34; 'however,': 0.34; 'eric': 0.34; 'idea': 0.34; 'explain': 0.36; 'url:python': 0.36; 'useful': 0.36; 'class.': 0.37; 'steven': 0.38; 'received:google.com': 0.38; 'url:org': 0.38; 'received:209.85': 0.38; 'should': 0.38; 'subject:: ': 0.39; 'why': 0.39; 'choose': 0.61; 'received:209.85.215.174': 0.67; 'received:mail-ey0-f174.google.com': 0.67; 'special': 0.67; 'liked': 0.80; '10:47': 0.84; 'snow': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=EoiDOR+/MnERC7xa1zOp6JvWMZKSnO72388+hXjcotI=; b=w6MMHwe8K6RXLNbraynsKigjbiFsJhgc+pha0pf4ZydFg/twLmrI3zCw9MYIIspMbK znNPZHX4AykR8aoqdPrwET1OvkN6y0xSLHaDYGY2VTz6xLnmvpMWicVsQGhhH4d+IHzz W6PWLNfmUWz6O4KlmkBAUlgipwGdVoO/ZatBM= |
| MIME-Version | 1.0 |
| In-Reply-To | <4e3e18ee$0$29985$c3e8da3$5496439d@news.astraweb.com> |
| References | <mailman.2004.1312686417.1164.python-list@python.org> <4e3e18ee$0$29985$c3e8da3$5496439d@news.astraweb.com> |
| Date | Sun, 7 Aug 2011 02:05:46 -0600 |
| Subject | Re: how to dynamically generate __name__ for an object? |
| From | Eric Snow <ericsnowcurrently@gmail.com> |
| To | "Steven D'Aprano" <steve+comp.lang.python@pearwood.info> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | quoted-printable |
| 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.2007.1312704349.1164.python-list@python.org> (permalink) |
| Lines | 34 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1312704349 news.xs4all.nl 23895 [2001:888:2000:d::a6]:34755 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:11002 |
Show key headers only | View raw
On Sat, Aug 6, 2011 at 10:47 PM, Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote: > Eric Snow wrote: > >> Thought I knew how to provide a dynamic __name__ on instances of a >> class. My first try was to use a non-data descriptor: > > Perhaps you should explain what you are trying to do. If you want to give > instances their own name, why not just give them an instance > attribute "name"? Double-leading-and-trailing-underscore attributes are > reserved for Python, and have special semantics. Again useful information failed to make it from my head to the keyboard. :) Currently I am looking at objects, regardless of their types, and keying off their name. If it is a module, class, or function object, the name should be stored in __name__ already. If it is an instance of the Base class I demonstrated, I would like to maintain that convention. However, you may have a good point. In other code I can simply check for the name attribute I choose for my objects and also check for __name__. I suppose I just liked the idea of having a single attribute to check. -eric > > > -- > Steven > > -- > http://mail.python.org/mailman/listinfo/python-list >
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
how to dynamically generate __name__ for an object? Eric Snow <ericsnowcurrently@gmail.com> - 2011-08-06 21:06 -0600
Re: how to dynamically generate __name__ for an object? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-08-07 14:47 +1000
Re: how to dynamically generate __name__ for an object? Eric Snow <ericsnowcurrently@gmail.com> - 2011-08-07 02:05 -0600
Re: how to dynamically generate __name__ for an object? Fuzzyman <fuzzyman@gmail.com> - 2011-08-10 07:48 -0700
Re: how to dynamically generate __name__ for an object? Ian Kelly <ian.g.kelly@gmail.com> - 2011-08-10 09:25 -0600
Re: how to dynamically generate __name__ for an object? Fuzzyman <fuzzyman@gmail.com> - 2011-08-10 09:38 -0700
Re: how to dynamically generate __name__ for an object? Eric Snow <ericsnowcurrently@gmail.com> - 2011-08-10 10:54 -0600
csiph-web