__import__ with dict values

alex goretoy aleksandr.goretoy at gmail.com
Fri Mar 13 15:12:49 EDT 2009


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_") ) )



-Alex Goretoy
http://www.goretoy.com



On Fri, Mar 13, 2009 at 1:46 AM, Lie Ryan <lie.1296 at gmail.com> wrote:

> Gabriel Genellina wrote:
>
>> En Thu, 12 Mar 2009 09:27:35 -0200, alex goretoy <
>> aleksandr.goretoy at gmail.com> escribió:
>>
>>  note i would still like to be able to do __import__("sys")."path"
>>>>
>>>
>> p = __import__("sys").path
>>
>> That's a convoluted way of doing:
>>
>> import sys
>> p = sys.path
>>
>> (except that the latter one inserts "sys" in the current namespace)
>>
>
> That's a convoluted way of doing:
>
> from path import sys
>
> (except that the latter one doesn't insert sys in the current namespace)
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090313/abac0a06/attachment.html>


More information about the Python-list mailing list