Re: using exec() to instantiate a new object.

2008-11-10 Thread RyanN
On Nov 10, 7:47 am, RyanN wrote: > Thank you both, I knew there had to be a good way of doing this. > > -Ryan Just an update. I used dictionaries to hold objects and their names. I'm beginning to understand better. Now to apply this to my actual problem. Here's the code I ended up with: class con

Re: using exec() to instantiate a new object.

2008-11-10 Thread George Sakkis
On Nov 10, 10:37 am, RyanN <[EMAIL PROTECTED]> wrote: > On Nov 10, 7:47 am, RyanN wrote: > > > Thank you both, I knew there had to be a good way of doing this. > > > -Ryan > > Just an update. I used dictionaries to hold objects and their names. > I'm beginning to understand better. Now to apply th

Re: using exec() to instantiate a new object.

2008-11-10 Thread RyanN
Thank you both, I knew there had to be a good way of doing this. -Ryan -- http://mail.python.org/mailman/listinfo/python-list

Re: using exec() to instantiate a new object.

2008-11-07 Thread Aaron Brady
On Nov 7, 4:23 pm, RyanN <[EMAIL PROTECTED]> wrote: > Hello, > > I'm trying to teach myself OOP to do a data project involving > hierarchical data structures. > > I've come up with an analogy for testing involving objects for > continents, countries, and states where each object contains some > att

Re: using exec() to instantiate a new object.

2008-11-07 Thread Patrick Mullen
On Fri, Nov 7, 2008 at 2:23 PM, RyanN <[EMAIL PROTECTED]> wrote: > > to do this I tried: > >def addCountry(self,country_name): ># create an instance of country >exec(country_name + "= country('" + country_name + "')") ># Add this new instance of a country to a list >