Re: [Tutor] Getting an object's attributes

2010-06-26 Thread mhw
Apol. For TP: This is perfect - thanks. Matt Sent from my BlackBerry® wireless device -Original Message- From: Evert Rol Date: Sat, 26 Jun 2010 11:13:16 To: Cc: Python tutor Subject: Re: [Tutor] Getting an object's attributes > I have an object to which I dynamically add at

Re: [Tutor] Getting an object's attributes

2010-06-26 Thread Steven D'Aprano
On Sat, 26 Jun 2010 06:39:29 pm m...@doctors.net.uk wrote: > Dear Tutors, > > I have an object to which I dynamically add attributes. My question > is how I can inspect and display them at run-time? > > Class a(): > pass > > Obj1 = a() > > Obj1.name = "Bob" > Obj1.age = 45 > > dir(a) returns a

Re: [Tutor] Getting an object's attributes

2010-06-26 Thread Evert Rol
> I have an object to which I dynamically add attributes. My question is how I > can inspect and display them at run-time? > > Class a(): >pass > > Obj1 = a() > > Obj1.name = "Bob" > Obj1.age = 45 First off, a few suggestions: - you probably mean 'class', not 'Class' (sorry, but it's just