It is possible to assign a class instance variable to a local variable within a method, such as:
class Foo(object):
def __init__(self):
self.bar = 'bar'
def baz(self):
# assign instance variable to local variable with a method
bar = self.bar
# do work with local variable
bar = "qux"
# update value of instance variable
self.bar = bar
return self
By doing this, one is able to refer to bar instead of self.bar within the scope of Foo.baz().
Is it wrong, or Unpythonic, to do this?