Re: __import__ with dict values

2009-03-14 Thread alex goretoy
This is a chunk of what its starting to look like now, thanks from colors import _available_colors as _ck from has_colors import _has_colors as _ha from log import _brush as _er class stdout_colors(object): def __init__(self,colors_active=1,output_caller=1,caller_color="red",default=1,

Re: __import__ with dict values

2009-03-14 Thread alex goretoy
I can show you people more code if you want :) I like to learn -Alex Goretoy http://www.goretoy.com On Sat, Mar 14, 2009 at 3:09 AM, alex goretoy wrote: > I'm actually still getting to this section of my code, I've been working a > logging,stdout colors lately, Although I am going to need __imp

Re: __import__ with dict values

2009-03-14 Thread alex goretoy
I'm actually still getting to this section of my code, I've been working a logging,stdout colors lately, Although I am going to need __import__ in several places in this program -Alex Goretoy http://www.goretoy.com On Sat, Mar 14, 2009 at 3:05 AM, alex goretoy wrote: > I don't get *why* someon

Re: __import__ with dict values

2009-03-14 Thread alex goretoy
> > I don't get *why* someone would like to write that. Does it look "cool"? Is > it some kind of "Look, ma, I know those hidden names!" syndrome? Is it > contagious? > I think thats what it is. It does look cool, thats for telling me about the fact that prevents the interpreter from doing many o

Re: __import__ with dict values

2009-03-13 Thread Gabriel Genellina
En Sat, 14 Mar 2009 00:31:55 -0200, Lie Ryan escribió: Gabriel Genellina wrote: En Fri, 13 Mar 2009 17:12:49 -0200, alex goretoy escribió: list( ( self.__setattr__(x.replace("b_",""),getattr(B,x)) for x in dir(B) if x.startswith("b_") ) ) __special__ methods are an implementation

Re: __import__ with dict values

2009-03-13 Thread Lie Ryan
Gabriel Genellina wrote: En Fri, 13 Mar 2009 17:12:49 -0200, alex goretoy 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=

Re: __import__ with dict values

2009-03-13 Thread Gabriel Genellina
En Fri, 13 Mar 2009 17:12:49 -0200, alex goretoy 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(

Re: __import__ with dict values

2009-03-13 Thread alex goretoy
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)

Re: __import__ with dict values

2009-03-12 Thread Lie Ryan
Gabriel Genellina wrote: En Thu, 12 Mar 2009 09:27:35 -0200, alex goretoy 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 curr

Re: __import__ with dict values

2009-03-12 Thread Gabriel Genellina
En Thu, 12 Mar 2009 23:00:30 -0200, alex goretoy escribió: Thank you. This makes sense to me. I will go with sys.modules. Can you give me a good example how to do it getattr way? obj.attr is the same as getattr(obj, "attr") (note the quotes). This makes more sense when you don't know th

Re: __import__ with dict values

2009-03-12 Thread alex goretoy
Gabriel, Thank you. This makes sense to me. I will go with sys.modules. Can you give me a good example how to do it getattr way? currently I am having this problem in my code. Kinda off subject, but not entirely. I set default variable in self.opt after that I import jar.properties into self.opt[

Re: __import__ with dict values

2009-03-12 Thread Gabriel Genellina
En Thu, 12 Mar 2009 09:27:35 -0200, alex goretoy 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) maybe if

Re: __import__ with dict values

2009-03-12 Thread alex goretoy
__import__(opt['imp_mod']).options eval(opt['imp_mod']+"."+opt['imp_opt']) how to make top work like bottom? -Alex Goretoy http://www.goretoy.com On Thu, Mar 12, 2009 at 5:56 AM, alex goretoy wrote: > note i would still like to be able to do __import__("sys")."path" > > maybe if __import__ ha

Re: __import__ with dict values

2009-03-12 Thread alex goretoy
note i would still like to be able to do __import__("sys")."path" maybe if __import__ had __str__ defined, How is my thinking on this? and how would I achieve something like this? -Alex Goretoy http://www.goretoy.com On Thu, Mar 12, 2009 at 5:44 AM, alex goretoy wrote: > or eval for that matte

Re: __import__ with dict values

2009-03-12 Thread alex goretoy
or eval for that matter -Alex Goretoy http://www.goretoy.com On Thu, Mar 12, 2009 at 5:43 AM, alex goretoy wrote: > yay, no more > > exec ("import " + "sys") > > in my code > > -Alex Goretoy > http://www.goretoy.com > > > > On Thu, Mar 12, 2009 at 5:42 AM, alex goretoy > wrote: > >> I have res

Re: __import__ with dict values

2009-03-12 Thread alex goretoy
yay, no more exec ("import " + "sys") in my code -Alex Goretoy http://www.goretoy.com On Thu, Mar 12, 2009 at 5:42 AM, alex goretoy wrote: > I have resolved this problem in my code. It has something to do with your > current working directory when you append cwd/jars to sys.path and try to >

Re: __import__ with dict values

2009-03-12 Thread alex goretoy
I have resolved this problem in my code. It has something to do with your current working directory when you append cwd/jars to sys.path and try to import from interactive console -Alex Goretoy http://www.goretoy.com On Thu, Mar 12, 2009 at 4:58 AM, alex goretoy wrote: > How would I import with

__import__ with dict values

2009-03-12 Thread alex goretoy
How would I import with __import__ from dict values? I want sys.path value inside d['syspath'], below code doesn't work for me d={} d['sys']='sys' d['path']='path' d['syspath']=__import__(d['sys'],fromlist=[d['path']]) and how come does above line doesn't give me diff value than below line? d