Radhey Parashar wrote:

> I am facing 1 issue with python related to append command in a list


> class CITY:
> 
>     num = 0
> 
>     connectivity = []

The way you wrote it the connectivity list is shared between all instances 
of the CITY class. Consult a Python tutorial to learn why.

To get per-instance lists you have to write an initializer like the one in 
the following example:

class City:
    def __init__(self, num):
        self.num = num
        self.connectivity = []


-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to