Return class.

Chris Angelico rosuav at
Sat Jul 26 21:16:01 CEST 2014

On Sun, Jul 27, 2014 at 5:04 AM, Satish ML <satishmlwizpro at> 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.


More information about the Python-list mailing list