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


Groups > comp.lang.python > #75258

Re: Return class.

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!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.019
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'attribute': 0.07; 'lines:': 0.09; 'output,': 0.09; 'wrapped': 0.09; 'cc:addr:python- list': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'output?': 0.16; 'subclass': 0.16; 'all.': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In- Reply-To:1': 0.27; 'am,': 0.29; "doesn't": 0.30; 'message- id:@mail.gmail.com': 0.30; 'code': 0.31; 'prints': 0.31; 'produces': 0.31; 'received:google.com': 0.35; 'object,': 0.36; 'list': 0.37; 'list.': 0.37; 'easily': 0.37; 'sure': 0.39; 'tag': 0.61; "you're": 0.61; "you'll": 0.62; 'different': 0.65; 'jul': 0.74; '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=GYsEEbbeqWXY9k+8YwB2s3TppC/YCvpzDgw1vD2FEeQ=; b=vJhCnFWBKugwskEbUL/sG9kLBfAWNLV4oazodNNUo/7tSyDRLmhXUvkQdpNH0cluSy SL2C91OzbvJgI0QZunYfOWdUhWwUVV00qSKfqhntRpqdLlwKqMZPQVDgiWFlxPGD0spV dp4F0X9MKuaDPm9odHPat86pEsqlNzao75REPuFxlqE/fOOwipYZ/QthAfA8TinM8+ci 97vShR7dFrpwEndgaG8oXar+SWCtGU1SLooLXMmvYru2QvvOnMT4dxvdzBOFYXANdEr4 beAw7gX9JDfECPtRACxrcjAx1TqtBgOtURBYB/rp5Fq2iAmATDivd0Up+nPjVBktcdNU mREw==
MIME-Version 1.0
X-Received by 10.220.105.201 with SMTP id u9mr2913017vco.11.1406402161742; Sat, 26 Jul 2014 12:16:01 -0700 (PDT)
In-Reply-To <d2cf78fd-cc30-47ca-b6a4-4117bc843cf0@googlegroups.com>
References <23517efd-6d71-4182-9f18-7aaae3b95afb@googlegroups.com> <mailman.12353.1406400496.18130.python-list@python.org> <d2cf78fd-cc30-47ca-b6a4-4117bc843cf0@googlegroups.com>
Date Sun, 27 Jul 2014 05:16:01 +1000
Subject Re: Return class.
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <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.12354.1406402170.18130.python-list@python.org> (permalink)
Lines 18
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1406402170 news.xs4all.nl 2888 [2001:888:2000:d::a6]:39742
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:75258

Show key headers only | View raw


On Sun, Jul 27, 2014 at 5:04 AM, Satish ML <satishmlwizpro@gmail.com> wrote:
> Which line of code is printing [4] and [4, 5, 6, 7] in the output?

These lines:

> print(x.wrapped)

The .wrapped attribute has the wrapped object, so you're printing out
the thing that would be in x if you weren't using the decorator. Since
that's a subclass of list and doesn't change __str__ or __repr__, it
prints out like a list.

Tip: If you're not sure what line produces what output, tag them all.
Instead of print(x.wrapped), put print(1,x.wrapped), and have a
different number on every line of output. Then you'll easily see which
is which.

ChrisA

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


Thread

Return class. Satish ML <satishmlwizpro@gmail.com> - 2014-07-26 11:29 -0700
  Re: Return class. Chris Angelico <rosuav@gmail.com> - 2014-07-27 04:40 +1000
    Re: Return class. Satish ML <satishmlwizpro@gmail.com> - 2014-07-26 12:02 -0700
    Re: Return class. Satish ML <satishmlwizpro@gmail.com> - 2014-07-26 12:03 -0700
    Re: Return class. Satish ML <satishmlwizpro@gmail.com> - 2014-07-26 12:04 -0700
      Re: Return class. Chris Angelico <rosuav@gmail.com> - 2014-07-27 05:16 +1000
    Re: Return class. Satish ML <satishmlwizpro@gmail.com> - 2014-07-26 12:21 -0700
  Re: Return class. Satish ML <satishmlwizpro@gmail.com> - 2014-07-26 12:15 -0700

csiph-web