attribute save restore

Carl K carl at personnelware.com
Fri Apr 13 15:08:39 EDT 2007


Is there a more elegant way of coding this:

x=o.p  # save .p
o.p=0
o.m()
o.p=x  # restore .p

seems very push/pop to me - like there should be a way that doesn't need a var 
(x) or the save/set lines should be done in one command.

(personally I think .m would better be implemented by passing in a parameter, 
but that isn't my choice.)

Carl K



More information about the Python-list mailing list