Python: showing attributes assigned to a class object in the class code
<p>One of my classes does a lot of aggregate calculating on a collection of objects, then assigns an attribute and value appropriate to the specific object: I.e.</p>

<pre><code>class Team(object):
    def __init__(self, name): # updated for typo in code, added self
        self.name = name

class LeagueDetails(object):
    def __init__(self): # added for clarity, corrected another typo
        self.team_list = [Team('name'), ...]
        self.calculate_league_standings() # added for clarity


    def calculate_league_standings(self):
        # calculate standings as a team_place_dict
        for team in self.team_list:
            team.place = team_place_dict[team.name] # a new team attribute
</code></pre>

<p>I know, as long as the <code>calculate_league_standings</code> has been run, every team has <code>team.place</code>. What I would like to be able to do is to scan the code for <code>class Team(object)</code> and read all the attributes, both created by class methods and also created by external methods which operate on class objects. I am getting a little sick of typing <code>for p in dir(team): print p</code> just to see what the attribute names are. I could define a bunch of blank <code>attributes</code> in the Team <code>__init__</code>. E.g.</p>

<pre><code>class Team(object):
    def __init__(self, name): # updated for typo in code, added self
        self.name = name
        self.place = None # dummy attribute, but recognizable when the code is scanned
</code></pre>

<p>It seems redundant to have <code>calculate_league_standings</code> return <code>team._place</code> and then add</p>

<pre><code>@property
def place(self): return self._place
</code></pre>

<p>I know I could comment a list of attributes at the top <code>class Team</code>, which is the obvious solution, but I feel like there has to be a best practice here, something pythonic and elegant here. </p>
