Re: Which class method is being called when we declare below expression?

2018-09-28 Thread Ben Finney
Ben Finney writes: > Ajay Patel writes: > > > L = [1,2,3] > > That's not an expression; it is an assignment statement. > > The right-hand side is an expression. […] in this case, [the object] a new > instance of 'list' […] is the result of evaluating the right-hand side > of the expression. I

Re: Which class method is being called when we declare below expression?

2018-09-28 Thread Ben Finney
Ajay Patel writes: > L = [1,2,3] That's not an expression; it is an assignment statement. The right-hand side is an expression. It will (at the top level) create a list. To create a new instance of the 'list' type, Python will call the type's '__new__' method. This is termed the constructor

Re: Which class method is being called when we declare below expression?

2018-09-27 Thread Chris Angelico
On Fri, Sep 28, 2018 at 8:52 AM Ajay Patel wrote: > > Hello gauys, > > Which list class method will call for below codes? > > L = [1,2,3] > And > L =[] None. Simple assignment does not call any methods. It just takes the value on the right hand side and says, hey, "L", you now mean that thing,

Which class method is being called when we declare below expression?

2018-09-27 Thread Ajay Patel
Hello gauys, Which list class method will call for below codes? L = [1,2,3] And L =[] Thanks, Ajay -- https://mail.python.org/mailman/listinfo/python-list