Re: import in a class

2008-11-26 Thread Chris Rebert
On Wed, Nov 26, 2008 at 9:30 AM, TP <[EMAIL PROTECTED]> wrote: > Hi everybody, > > Here is a file "test_import_scope.py": > ## > class a(): > import re > def __init__( self ): > if re.search( "to", "toto" ): > self.se = "ok!" > def print_se( self ): > print self.se >

import in a class

2008-11-26 Thread TP
Hi everybody, Here is a file "test_import_scope.py": ## class a(): import re def __init__( self ): if re.search( "to", "toto" ): self.se = "ok!" def print_se( self ): print self.se a().print_se() ## When python executes this file, we obtain an error: