"Olivier Lefevre" <lefevrol at yahoo.com> wrote in message news:51809ae4.0309030715.7706cadb at posting.google.com... > Python 2.3 > >>> def foo(): > ... foo.a = 1 If you want foo to be attributed before it is called, move the setter outside the function. >>> def foo(): pass ... >>> foo.a = 1 >>> vars(foo) {'a': 1} Terry J Reedy