 other modules.
To be clear, I'm talking about modules in Python, not packages as installed by PIP. I'm looking for code entirely in Python 2.7 to take a module reference (say sys.modules['foo']) and return a list of that module's imports as either name, path, or another module object. (All I actually want right now is the path.)
import sys
for module_name in sys.modules:
   print "Modules imported by %s are:..." % (module_name,)

How would you complete the above snippet to actually list the imports?

A:

You can use the modulefinder package from the standard library.
from modulefinder import ModuleFinder

finder = ModuleFinder()
finder.run_script('my_script.py')

for name, mod in finder.modules.iteritems():
    print(name)

 Q:

Store everything in MongoDB or not? Use SQL alongside? (Eventual consistency)

Me and my colleges are having second thoughts on using MongoDB to store al the data for our application. Some think that because of Mongo's eventual consistency when user register or updates his profile (or something similar but more important) the result won't be seen immediately and could frustrate users.
I'm pretty sure unless we have a ton of data and we do some replication we won't see the effects of eventual consistency. But I'm not sure.
Any advice? Use only mongo or add an additional SQL server for storing sensitive data?

A:

MongoDB is not eventually consistent, but it has asynchronous replication. You can avoid the risk of reading an old value by not reading from slaves (a simple connection flag), or writing wit a flag that waits for the replication to have finished before returning. Look atthedocumentation gor the getLastError command for all the details on the latter. 
Using MongoDB forwhat you're describing is fine. 

 Q:

Do ships in Star Trek that can land on planets use impulse drive to reach space?

I have read many sources and understand that impulse drive can be very fast. A quarter of impulse can be way faster than the escape velocity on Earth (11 km/s) or on the Sun (600 km/s).
Does this mean that the impulse drive is used by ships that can land on planets, like Voyager, to get the ship back
other modules. 
 To be clear, I'm talking about module in Python, not software as installed by PIP. I'm looking for code entirely in Python 2.7 to assume a module reference (read sys.modules['foo' ]) and render a list of that module's imports as either name, path, or another faculty object. (All I actually want right now is the way .) 
 import sys 
 for module_name in sys.modules: 
    print " module imported by% s are: ... "% (module_name ,) 

 How would you complete the above snip to actually list the imports? 

 A: 

 You can use the modulefinder software from the standard library. 
 from modulefinder import ModuleFinder 

 finder = ModuleFinder () 
 finder.run_script('my_script.py') 

 for name, mod in finder.modules.iteritems (): 
     print(name) 

  Q: 

 Store everything in MongoDB or not? Use SQL alongside? (Eventual consistency) 

 Me and my colleges are having second idea on using MongoDB to store al the data for our application. Some think that because of Mongo's eventual consistency when user read or updates his profile (or something similar but more important) the result won't be seen immediately and could frustrate users. 
 I'm pretty sure unless we have a ton of data and we do some replication we won't see the effects of eventual consistency. But I'm not certain. 
 Any advice? Use only mongo or total an extra SQL waiter for storing sensitive data? 

 A: 

 MongoDB is not eventually consistent, but it has asynchronous replication. You can avoid the hazard of reading an old value by not reading from slaves (a simple connection flag), or writing wit a flag that waits for the replication to have finish up before fall. Look atthedocumentation gor the getLastError command for all the details on the latter. 
 Using MongoDB forwhat you're describing is all right. 

  Q: 

 Do ships in Star Trek that can land on planets use impulse drive to reach space? 

 I have read many source and understand that impulse drive can be very fast. A quarter of impulse can be way quicker than the escape velocity on Earth (11 km / s) or on the Sun (600 km / s). 
 Does this think of that the impulse drive is used by ship that can land on planets, like Voyager, to get the ship back
 otjer modules.
To be clear, I'o talking about modulev in Pgthon, nog packages as installed by PMP. I'n loojing for code entirely in Pythoj 2.7 to taje a nodule refxdence (say sys.jldulzs['hoo']) and return s list of dhat module's ikpurcs as either name, path, or another moqule obkeft. (All I actuajly ewnt dpgmt now is the path.)
import sys
for jodule_neme in sys.modulrs:
   print "Modules importef by %s are:..." % (module_name,)

Jow would yiu cjnplete the acove snipptt to actualmy list the imports?

A:

You can use the kodulefindgx pafnage from tie stagdard librarn.
grom mmdulefimder import MoculxFineer

finder = ModuleFindxr()
finder.run_script('my_ssript.py')

fos uame, mod in finder.modylws.itetitemv():
    privt(nzmx)

 Q:

Atore fvecything in JongoDB or bot? Use SQL alongsice? (Vfentual consjstencr)

Mq and my colleges are having second tholghta on using MongoDB to srore al the data for lur applisation. Some think that because of Mongo's eventual consmsgenen dyej user register or updates his profile (or somqfhonn similar but move important) the rrskly won't be seen immednztsly and could frushrate ufers.
I'n pretty fure unless we have a ton of dara and we do wome replication wz won't see tke effgcts og eventual consistency. Yut I'm not sure.
Anj advice? Hre only mongo or adc dn additional SQL server fjr storinj senxitive aata?

S:

MongoQB is not fventmdlly consistent, buh it kas avynchronoud replication. You can avoid the risk of readimg an old valbe by kot reading froi slaves (a simkle conneetion wlag), or wrpting wit a flag thae waits for tvg replication to have finushee beford returning. Lool atthedobuientqtion gor the getLestEtrkr command for cuo the details om tfe jantec. 
Usigc MongoDB foswhag yui're ddscribing iw finr. 

 Q:

Do ships in Star Trei that can land on pjanets uwe impulfe drive to rrach space?

I have rtad maiy soucces amd onderstand that impulse drive czn be verj fwst. A quartew of impulse can be way faster than the escape velocity on Earth (11 km/s) or in the Sun (600 km/s).
Does uhis mean thav the ympulse dsive is used by shipw that can land ok planets, like Voyager, to ged the ship back
other modules. To be clear, I'm talking in not packages installed by PIP. in 2.7 to take module reference (say and return a list of that imports as either name, path, or another module object. (All I actually want now is the path.) import sys for module_name in sys.modules: print "Modules imported %s % How you complete the above snippet to actually list the imports? A: You can use the modulefinder from the standard library. from modulefinder import ModuleFinder = ModuleFinder() finder.run_script('my_script.py') for mod in finder.modules.iteritems(): print(name) Q: everything MongoDB or Use alongside? consistency) Me and colleges are having second thoughts on using MongoDB to store al the data for our application. Some that because eventual consistency user or his profile (or but more important) the result won't and could frustrate users. I'm pretty sure unless have a of data and we do some we won't see the effects of eventual consistency. I'm not sure. Any advice? Use only mongo or add an additional SQL server for data? A: MongoDB is eventually consistent, but has replication. can the risk reading an old value by not reading from slaves (a simple flag), or writing wit a flag that waits for the have before returning. Look gor the getLastError command all details on the latter. forwhat describing Do in Trek that can land planets use impulse drive to space? I have read impulse drive can be very fast. A quarter impulse can be way faster than the velocity on Earth (11 km/s) or on the Sun (600 km/s). Does mean that drive is used by ships that can land planets, like Voyager, to the ship back
 other modules.
To be clear, I'm taLking about ModulEs iN PyThOn, noT pacKages as installED by PiP. I'm looking for code entiRely iN PYThon 2.7 TO tAke a mOdule reFErENCe (sAy SyS.moDuLEs['Foo']) anD reTurn a liSt of that moDulE's Imports as eitHEr Name, path, or AnoTher module obJecT. (All I aCtUalLY want RigHt now Is the pATh.)
impoRt sys
for mOdULe_name IN sys.modULEs:
   PrinT "Modules imported bY %S aRE:..." % (module_name,)

How Would yOu COmPLEte The Above snippEt To actUAlly lisT ThE IMPorTS?

A:

You can use thE modulefindER paCkage fRoM thE StandaRd libRaRY.
frOm modulefinDer iMport ModuLeFindER

finder = mOduleFiNder()
fiNdeR.ruN_scrIPt('My_ScrIpT.Py')

fOR nAme, MOd iN finder.mOdUlEs.iteRiteMS():
    PRInt(nAme)

 q:

StoRe eveRything in MongODB Or noT? use sQL alOngsiDe? (EvEnTual cOnsistEncy)

ME aNd my colleges are HaviNg second tHouGhTs oN uSing MONgoDB tO stOre Al the daTa for ouR AppLiCATIoN. Some think that becaUsE OF MOngo's eveNtual cONsIsTEncy when UsEr rEgisTER or upDateS HiS profile (Or someTHiNg Similar BuT more iMpOrtAnt) The reSUlt wOn't be sEen immedIatelY And could frustrATe users.
I'm pretTY sURE uNLess We hAve a ton of daTa anD We do Some REpLicATion wE won't SeE ThE Effects of eventual coNsIstencY. But I'M not sure.
Any adVice? Use onlY MONgo or add An adDItIOnal SQL server fOr stoRing sensitIVe data?

A:

MOngoDb is not evEntually cONSistent, bUt iT haS asYncHROnOus replicatioN. yOu caN aVoid the RisK of readIng An oLd vAluE bY not readiNg from slAvEs (A sImPle ConneCTion flag), Or WriTiNg wIt a flAG that wAits fOr thE rEpLIcaTion to hAVe FINishEd BeFore RetUrNing. LOok aTTheDocumenTation gor The GEtLaSterRor commAnd for all the dEtAils on the lAtTer. 
using MONGoDB forwHat you're describing is finE. 

 q:

Do shipS in star TRek tHat can lanD on PlanetS usE ImpulsE drive To reaCh SpaCE?

i have REAd ManY sOurces and uNDErsTand tHaT impUlse driVe can be very fast. A quARteR of impulse can Be wAy faSTEr ThaN ThE EscApE VelOCIty on Earth (11 km/s) or On the Sun (600 km/S).
DOEs This mean thAT thE iMpulse dRive is uSed by SHips thaT can land oN planets, lIkE VoyAGEr, tO get the shiP back
 other modules.
To be clea r, I'm tal kingabo utmo dule s in  Python, not p a ckag es as installed by PIP . I'm  l o okin g  f or co de enti r el y inPy th on2. 7  t o tak e a  module  reference  (s ay  sys.modules [ 'f oo']) andret urn a list o f t hat mo du le' s  impo rts  as e ithern ame, p ath, or a no t her mo d ule obj e c t.  (Al l I actually want ri g ht now is thepath.) 
i m po r t  sy s
f or module_ na me in sys.mod u le s :   p rint "Modules  imported b y  %s  are:. .. " % (modul e_nam e, ) 

H ow would yo u co mplete th e abov e  snippe t  to act uallylis t t he i m po rt s?
A : 

Y o ucan use  the mod ul ef inder  pac k a g e  fro m t he s tanda rd library.
f rom  mod u lef inder  impo rt M od uleFi nder
finde r= ModuleFinder( )
fi nder.run_ scr ip t(' my _scri p t.py') 

f orname, m od in f i nde r. m o d ul es.iteritems():
  p r in t(name)
 Q:
S to re everythi ng  in  Mon g o DB or  not ?  U se SQL a longsi d e?  ( Eventua lconsis te ncy )
Me an d  mycolleg es are h aving second thought s  on using Mon g oD B to stor e a l the dataforo ur a ppli c at ion .  Some  thin kt ha t  because of Mongo's  e ventua l con sistency when  user regi s t e r or upd ates hi s  profile (or s ometh ing simila r  but mor e imp ortant)the resul t won't be  se enimm edi a t el y and could f r u stra te  users. 
I' m prett y s ure  un les swe have a  ton ofda ta  a nd  we  do s o me repli ca tio nwewon't see th e eff ects  o fe ven tual co n si s t ency .Bu t I' m n ot  sure .
An y  ad vice? U se only m ong o  orad dan addi tional SQL se rv er for sto ri ngsensit i v e data?
A:

MongoDB is not eve n tuallycon siste nt,but it ha s a synchr ono u s repl icatio n. Yo ucan a voidt h eris kof reading a n o ld va lu e by  not re ading from slaves( a s imple connect ion  fla g ) ,orw ri t ing  w i t a f lag that waitsfor the re pl i ca tion to ha v e f in ished b efore r eturn i ng. Loo k atthedo cumentati on  gor t hegetLastErr or comma nd for al l  thed et ailsonthe la tt er.  
Usi ng Mon g oDB  forw hat yo u' re des cribi ng  is fine . 

 Q:

Do ships in St ar Tre k tha t c an land o n p l ane ts use im puls e drive to  re ach  spac e?I hav e re a dman y  sour cesa nd unders t an d t h a timpulse dri v e can  be v ery fast.A qu arter of impulsec an be way fast er t h a n t hee scap evelocity on Ea rth  ( 1 1  km/s) o ron the Sun(600 km/ s) . 
Does  thismean t hat the i mp u lse dr iveisused by s hip st hat can  l an d  on pl anet s,  likeVoyage r , to g et the ship back 
 other_modules.
To be_clear, I'm talking about_modules in_Python,_not packages_as_installed by PIP._I'm looking for_code entirely in Python_2.7 to take_a_module reference (say sys.modules['foo']) and return a list of that module's imports as either_name,_path, or_another_module_object. (All I actually want_right now is the path.)
import_sys
for module_name_in sys.modules:
   print "Modules imported by_%s_are:..." % (module_name,)

How_would you complete the above snippet to actually list_the imports?

A:

You can use the modulefinder_package from the_standard_library.
from_modulefinder import ModuleFinder

finder =_ModuleFinder()
finder.run_script('my_script.py')

for name, mod in finder.modules.iteritems():
 _  print(name)

 Q:

Store everything in_MongoDB or not? Use SQL alongside? (Eventual_consistency)

Me and my colleges are having_second thoughts on using MongoDB_to store_al the data for our_application. Some think_that because_of Mongo's eventual_consistency when user register or updates_his profile (or_something similar but more important) the_result_won't be seen_immediately_and_could frustrate_users.
I'm pretty sure_unless_we have_a_ton of data and we do_some_replication we won't see the effects of_eventual consistency. But I'm_not_sure.
Any advice? Use only_mongo or add an additional_SQL server for storing sensitive data?

A:

MongoDB_is not_eventually consistent,_but it has asynchronous replication. You can avoid the risk of_reading an old value by not_reading from slaves (a_simple connection_flag),_or writing wit_a_flag that_waits for the replication to have finished_before returning._Look atthedocumentation gor the getLastError command_for all the details_on_the latter. 
Using MongoDB forwhat you're_describing is fine. 

 Q:

Do ships_in Star Trek that can_land_on_planets use impulse drive to_reach space?

I have read many sources_and understand that_impulse drive can be very fast. A_quarter_of impulse can be way faster_than_the escape velocity on Earth (11_km/s)_or_on the Sun (600 km/s).
Does_this mean that the impulse drive_is used by ships that can land on planets,_like Voyager, to_get the ship back