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


Groups > comp.lang.python > #81664

Re: Can you use self in __str__

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news2.arglkargh.de!news.albasani.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!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 OK 0.071
X-Spam-Evidence '*H*': 0.86; '*S*': 0.01; 'namespace': 0.09; 'cc:addr :python-list': 0.11; 'all?': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'wrote:': 0.18; 'first.': 0.19; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply- To:1': 0.27; 'function': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'fri,': 0.33; 'case,': 0.35; 'received:google.com': 0.35; "i'll": 0.36; 'nov': 0.38; 'pm,': 0.38; 'bad': 0.39; 'subject:Can': 0.60; 'subject:self': 0.84; 'subject:you': 0.87; '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=W/vUGJvCWzh/5nEEd9PXiaS5xvFL36bXZElaOhqOiJA=; b=En59LCpJQLy6VTKllbQKvq5E9VNVy6f3ZttsqSBkbiS9SPZX0Bxeu1W101qC4Rs2X5 UujEx5VfDh9JLMFLLH/aj+MoY2/V9uof+nrxaT+E3n0IxWQusbh23gANCrl2wc9merjt SjQqptYCxDsET68ffIUFfVyEYPZcmaRV61DlXNkgJXjqUBnEUvggosmANrQAI+gCK9NE 38F/G0pGCpa7G9hZItiky+X64np9SePm680Yl4q2MQdA4yQfJHnpet7h2WBH+54sdMNj CD+MC8cz8D3xN0NgxdWPBJIM+boCXWJ7VvRa4EUu5OJYODKLp3o3eRwwjSOi5ben7YGH 5I2g==
MIME-Version 1.0
X-Received by 10.50.23.48 with SMTP id j16mr21444739igf.34.1417150843414; Thu, 27 Nov 2014 21:00:43 -0800 (PST)
In-Reply-To <CAJQX3DwmK2FedvbVMUq5Mm2yMSfD5QQWz3qqph5oj2_tzZyMvA@mail.gmail.com>
References <9oif7apuou9fbaqjk0i3l2pq1theuso4un@4ax.com> <CAJQX3DwmK2FedvbVMUq5Mm2yMSfD5QQWz3qqph5oj2_tzZyMvA@mail.gmail.com>
Date Fri, 28 Nov 2014 16:00:43 +1100
Subject Re: Can you use self in __str__
From Chris Angelico <rosuav@gmail.com>
Cc Python <python-list@python.org>
Content-Type text/plain; charset=UTF-8
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 <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.16391.1417150852.18130.python-list@python.org> (permalink)
Lines 10
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1417150852 news.xs4all.nl 2830 [2001:888:2000:d::a6]:49540
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:81664

Show key headers only | View raw


On Fri, Nov 28, 2014 at 2:04 PM, Shiyao Ma <i@introo.me> wrote:
> What if it's in the local namespace of a function or method? IDK, try
> to get that thing first.

What if it's in multiple namespaces? What if it's not in any at all?
Your solution is not going to work in the general case, AND it's a bad
idea. Please don't do this in any code that I'll ever have to
maintain.

ChrisA

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


Thread

Can you use self in __str__ Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-11-27 20:26 -0500
  Re: Can you use self in __str__ Dave Angel <davea@davea.name> - 2014-11-27 21:49 -0500
    Re: Can you use self in __str__ Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-11-27 22:31 -0500
      Re: Can you use self in __str__ Dave Angel <davea@davea.name> - 2014-11-28 04:37 -0500
  Re: Can you use self in __str__ Shiyao Ma <i@introo.me> - 2014-11-28 11:04 +0800
    Re: Can you use self in __str__ Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-11-27 22:35 -0500
      Re: Can you use self in __str__ Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-28 18:44 +1100
  Re: Can you use self in __str__ Chris Angelico <rosuav@gmail.com> - 2014-11-28 16:00 +1100
  Re: Can you use self in __str__ Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-28 19:25 +1100
  Re: Can you use self in __str__ Chris Angelico <rosuav@gmail.com> - 2014-11-28 12:43 +1100
  Re: Can you use self in __str__ Dave Angel <davea@davea.name> - 2014-11-28 06:43 -0500
  Re: Can you use self in __str__ Rustom Mody <rustompmody@gmail.com> - 2014-11-28 06:21 -0800
    Re: Can you use self in __str__ Rustom Mody <rustompmody@gmail.com> - 2014-11-28 08:37 -0800
  Re: Can you use self in __str__ Shiyao Ma <i@introo.me> - 2014-11-29 11:16 +0800
  Re: Can you use self in __str__ Chris Angelico <rosuav@gmail.com> - 2014-11-29 14:36 +1100
  Re: Can you use self in __str__ Shiyao Ma <i@introo.me> - 2014-11-29 11:55 +0800

csiph-web