Re: Import if condition is correct

2006-10-30 Thread Bruno Desthuilliers
MindClass wrote: > Is possible import a library according to a condition? > > if Foo = True: > import bar > Did you even try ? Would have been faster than posting here... -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'

Re: Import if condition is correct

2006-10-28 Thread Steve Holden
MindClass wrote: > Steve Holden wrote: > >>I'm guessing that you think this might be necessary to avoid importing >>the same module multiple times: it's not. Python only runs the module's >>code the first time the module is imported into a program. A further >>import statement effectively does not

Re: Import if condition is correct

2006-10-28 Thread MindClass
Steve Holden wrote: > I'm guessing that you think this might be necessary to avoid importing > the same module multiple times: it's not. Python only runs the module's > code the first time the module is imported into a program. A further > import statement effectively does noting, because the inte

Re: Import if condition is correct

2006-10-28 Thread Steve Holden
MindClass wrote: > Georg Brandl wrote: > >>MindClass wrote: >> >>>Is possible import a library according to a condition? >>> >>>if Foo == True: >>>import bar >>> >> >>Why don't you try it? >> > > I thinked that could be another way for import statement. > > In that case I'll have to set a gl

Re: Import if condition is correct

2006-10-28 Thread MindClass
Georg Brandl wrote: > MindClass wrote: > > Is possible import a library according to a condition? > > > > if Foo == True: > > import bar > > > > Why don't you try it? > I thinked that could be another way for import statement. In that case I'll have to set a global variable before of the impo

Re: Import if condition is correct

2006-10-28 Thread Georg Brandl
MindClass wrote: > Is possible import a library according to a condition? > > if Foo = True: > import bar > Why don't you try it? (in the above code, not the import is the problem, but using the assignment operator in an expression) Georg -- http://mail.python.org/mailman/listinfo/python-