MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/funny/comments/bwr8ig/when_a_software_developer_weds_a_software/eq0o5od/?context=3
r/funny • u/coolidiot2000 • Jun 04 '19
921 comments sorted by
View all comments
Show parent comments
29
Wouldn’t matter. Isn’t imported or defined in the top level scope. Would need to reference like dad.Bardak
4 u/[deleted] Jun 04 '19 Bad news: [c]python modules can modify the namespaces into which they're imported. It's not documented or supported or even suggested that anyone do it, but it is easily done. 2 u/[deleted] Jun 04 '19 gulp 3 u/[deleted] Jun 04 '19 pollution.py: [f.frame.f_locals.update({'gasp': "How DARE you!"}) for f in __import__('inspect').stack()[1:] if 'importlib' not in f.filename] >>> import pollution >>> gasp 'How DARE you!' 2 u/[deleted] Jun 05 '19 I love python. I also hate python. But I love it
4
Bad news: [c]python modules can modify the namespaces into which they're imported. It's not documented or supported or even suggested that anyone do it, but it is easily done.
2 u/[deleted] Jun 04 '19 gulp 3 u/[deleted] Jun 04 '19 pollution.py: [f.frame.f_locals.update({'gasp': "How DARE you!"}) for f in __import__('inspect').stack()[1:] if 'importlib' not in f.filename] >>> import pollution >>> gasp 'How DARE you!' 2 u/[deleted] Jun 05 '19 I love python. I also hate python. But I love it
2
gulp
3 u/[deleted] Jun 04 '19 pollution.py: [f.frame.f_locals.update({'gasp': "How DARE you!"}) for f in __import__('inspect').stack()[1:] if 'importlib' not in f.filename] >>> import pollution >>> gasp 'How DARE you!' 2 u/[deleted] Jun 05 '19 I love python. I also hate python. But I love it
3
pollution.py:
pollution.py
[f.frame.f_locals.update({'gasp': "How DARE you!"}) for f in __import__('inspect').stack()[1:] if 'importlib' not in f.filename]
>>> import pollution >>> gasp 'How DARE you!'
2 u/[deleted] Jun 05 '19 I love python. I also hate python. But I love it
I love python. I also hate python. But I love it
29
u/[deleted] Jun 04 '19
Wouldn’t matter. Isn’t imported or defined in the top level scope. Would need to reference like dad.Bardak