On Fri, Sep 28, 2018 at 8:52 AM Ajay Patel <ajay.patel...@gmail.com> 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, 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 predictable! ChrisA -- https://mail.python.org/mailman/listinfo/python-list