When different modules in Python import an object in the same module, are they all the same object?

suppose I define an object obj in the module base , and then import > object obj .

in the modules a , b and c .

then I modified obj in the module a . Will the obj in the modules b and c be modified accordingly? Why?

Mar.09,2021

Let me give you a simple example (environment: Python shell 3.6.5)

step1 : write t.py and save it on your desktop.

clipboard.png

step2: shellpath

clipboard.png

step3: import ttest

clipboard.png

step4:

clipboard.png
clipboard.png
,py

:
pythonpyshell)1impreload0

.


  • base:


  • a:


  • b:


  • run.py:


  • :


from base import num, lst num, lst, num base, lst base.

import base num, lst, base.

:

  • from xxx import xxx
  • import xxx module.xxx

, ,

:





python m_all.py:

clipboard.png

because this is actually the same object

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-1b393b4-2c184.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-1b393b4-2c184.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?