This is a 'with' method for Python -- the equivalent of the 'with' statement in Pascal or VB: import re def with(object, statements): """ 'with' for the very lazy programmer :) Someone might prefer using Ctrl+C, Ctrl+V, ... instead.""" exec(re.sub('\B\.', '%s.' % object, statements)) #--- example usage: class a_class: pass an_instance_of_a_class_with_a_very_long_name = a_class() with ('an_instance_of_a_class_with_a_very_long_name', ''' .var1 = 111 .var2 = 222 .var3 = 333 .var4 = 444 .var5 = 555 ''') with ('an_instance_of_a_class_with_a_very_long_name', ''' print .var1, .var2, .var3, .var4, .var5 ''') Regards, Levente Sandor