globals


python globals dictionary


I want to merge a dictionary , recieved from another module as a function argument to the globals dictionary of the current module. Any idea how this can be done ?
module - test.py
def setdict(indict):
somedict = dict(globals(), **indict)
what i want is, the resultant dictionary somedict is to be set as the globals dictionary of the current module (test) . somedict was created by merging globals() of the current module and the recieved dictionary indict.
globals() returns the current module's global dictionary, which you can then modify. Your function would like:
def setdict(indict):
globals().update(indict)
If there are name clashes, the indict dictionary will win.

Related Links

PHP form mail and register globals
python globals dictionary

Categories

HOME
shell
xml
cheerio
c++11
eslint
apache-flink
webdriver
static
components
package
devise
spring-data-redis
switch-statement
dojo
nested-if
babeljs
spring-session
gson
watson-conversation
java.util.logging
favicon
pybossa
qsqlquery
docx
scsi
chargify
resourcebundle
openmdao
iis-express
sql-server-2000
hibernate-validator
erb
dsx-desktop
gnat-gps
modalviewcontroller
browser-extension
navigator
filesystemwatcher
xv6
android-checkbox
ntvs
magento-2.0.7
page-replacement
semantic-logging
cpu-cache
sandcastle
atlas
burrows-wheeler-transform
dotnetnuke-7
watch-os-2
macaulay2
lua-telegram-bot
tracker-enabled-dbcontext
project-organization
libav
libvlc
rewrite
page.js
.bash-profile
viola-jones
vacuum
sha512
rdflib
skspritenode
canvg
snoop
shopizer
qtwebengine
cross-join
pseudo-class
cocos3d
trdion2011
build-script
dct
android-framework
embedded-fonts
workitem
nebula
android-icons
android-loadermanager
wcf-configuration
subgraph
jdb
database-create
jsr286
virtualpathprovider
luabind
denied
listactivity
timthumb
perl5.12
java1.4
change-management

Resources

Encrypt Message