Which class method is being called when we declare below expression?
On Fri, Sep 28, 2018 at 8:52 AM Ajay Patel <ajay.patel305 at gmail.com> wrote:
> Hello gauys,
> Which list class method will call for below codes?
> L = [1,2,3]
> 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, k? k. :)
With *augmented* assignment (eg "x += 1"), there are methods that get
called, and with non-assignment operators (eg "x + 1"), similarly.
Generally the left hand side defines the behaviour. But simple
assignment is defined purely within the language, as are a handful of
other operators ("x is y", "x and y"). Keeps things simple and