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


Groups > comp.lang.python > #75254

Re: Return class.

Newsgroups comp.lang.python
Date 2014-07-26 12:02 -0700
References <23517efd-6d71-4182-9f18-7aaae3b95afb@googlegroups.com> <mailman.12353.1406400496.18130.python-list@python.org>
Message-ID <2f69e9c6-6d81-4fc4-bb39-889846842f75@googlegroups.com> (permalink)
Subject Re: Return class.
From Satish ML <satishmlwizpro@gmail.com>

Show all headers | View raw


Which line of code is printing [4] and [4, 5, 6, 7] in the output?

from tracer import Tracer
@Tracer
class MyList(list):
    def __init__(self, *args):
        print("INSIDE MyList")
        print(*args)
        x = MyList([1, 2, 3])
x.append(4)
print(x.wrapped)
WrapList = Tracer(list)
x = WrapList([4, 5, 6])
x.append(7)
print(x.wrapped)

OUTPUT:

CARST
Trace: display
1
Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!
[1]
Trace: name
1
Bob
Trace: pay
2
2000

Trace: name
1
Sue
Trace: pay
2
6000
Trace: name
3
Bob
Trace: pay
4
2000
[4, 2]
INSIDE MyList
[1, 2, 3]
Trace: append
1
[4]
Trace: append
1
[4, 5, 6, 7]

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