treyhunner, 17 days ago @iris Great ones! Here's an even shorter equivalent to locals(): vars() Relatedly: dir() (for just the names) Also vars(an_object) or dir(an_object). Since vars(an_object) only looks at dict they're a bit different. Sometimes I'll do vars(an_object).keys() to see just the attributes that live directly on an object.
@iris Great ones!
Here's an even shorter equivalent to locals():
vars()
Relatedly: dir() (for just the names)
Also vars(an_object) or dir(an_object).
Since vars(an_object) only looks at dict they're a bit different. Sometimes I'll do vars(an_object).keys() to see just the attributes that live directly on an object.