I think there is a problem with Manager.dict () which is in the list When it is done (within a sub-process), when I modify it within the function, the new value is not available outside. To create a list of such tasks:
gwfuncs = [reboot, flush_macs, flush_cache, new_gw, revert_gw, send_log] gw_func_dict = dict ((chr (2 ** i) gwfuncs [I]) for xrange (0, min (lane (gwfuncs), 8)) in and then say this like this:
in Gw_func_dict.keys (): if gwupdate & amp; Ord (bit) == ord (bit): gw_func_dict [bit] (FH, maclist) Now we talk about the flush_macs () , Whatever I am doing in the MacList function, does not affect the Maclit outside my function - why is it? How can I modify it that is available outside of your changes?
After
== and So your if statement actually works like this:
if gwupdate & amp; (Ord (bit) == ord (bit)): Add some brackets and this will work:
if (gwupdate & amp; bit) ) == ord (bit): In addition, you can make your code a little easier:
gw_func_dict = dict (( For chr (2 * * I, func), fun in Enkaneer (gwfuncs [: 8])) And if you have Python 2.7 +:
< Using the code> gw_func_dict = {chr (2 ** i): function for calculating function, (gwfuncs [: 8])} In addition, the default Repeating a dictionary on your keys as a form More repetition than that, so that you can extract from .keys () to your from loop:
in gw_func_dict:
No comments:
Post a Comment