Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #75258
| References | <23517efd-6d71-4182-9f18-7aaae3b95afb@googlegroups.com> <mailman.12353.1406400496.18130.python-list@python.org> <d2cf78fd-cc30-47ca-b6a4-4117bc843cf0@googlegroups.com> |
|---|---|
| Date | 2014-07-27 05:16 +1000 |
| Subject | Re: Return class. |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.12354.1406402170.18130.python-list@python.org> (permalink) |
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 | Next — Previous in thread | Next in thread | Find similar | Unroll 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