__import__ with dict values
Lie Ryan
lie.1296 at gmail.com
Fri Mar 13 22:31:55 EDT 2009
Gabriel Genellina wrote:
> En Fri, 13 Mar 2009 17:12:49 -0200, alex goretoy
> <aleksandr.goretoy at gmail.com> escribió:
>
>> wow, ok, thank you Gabriel, I wasn't aware of x,'y',z
>>
>> This is what I decided to go with for now in one of my classes, but
>> another
>> class will need a modified version of this, as mentioned x,'y',z
>>
>> B=_brush()
>>
>> list( ( self.__setattr__(x.replace("b_",""),getattr(B,x)) for
>> x in
>> dir(B) if x.startswith("b_") ) )
>
> __special__ methods are an implementation detail that you should not use
> explicitely; instead of obj.__setattr__(name, value) use setattr(obj,
> name, value).
Except if you want to override the special methods like in operator
overloading.
More information about the Python-list
mailing list