I declared an empty dictionary at the front of the class. Why does the function suddenly have a value in it?

do questions on a platform similar to leetcode, youdao connectivity search.

clipboard.png

The

function is placed in the class
instead of using def _ _ init__ at the beginning of the class, an empty dictionary is declared directly

but when you run the problem-solving function later, when you basically do nothing at first,
print to see why there is value in this empty dictionary.

(the outer main function only calls the accountsMerge function)

what"s going on?

and this code point test passed, the dictionary behind the test is still empty, but as soon as it is submitted, it will become a situation in which the dictionary suddenly has a value.

later, puzzled, I created a new def _ _ init__ initialization function, and put father= {} into it before passing

.

what on earth is going on? Why does it suddenly have value, or does it just have a system bug?

Jun.16,2022

you can use leetcode to do exercises
when he verifies, it's like this.

a = Solution() -sharp a
a.accountMerge(xxx) == xxxx -sharp 
a.accountMerge(xxx1) == xxxx2 -sharp afatherfather
accountMergeself.father = {} 
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37a02-2c08e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37a02-2c08e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?