On 12/29/2009 3:01 PM, Миклухо wrote:
On 28 дек, 18:29, "Martin v. Loewis" wrote:
In this case (you just started to learn Python), I recommend to take
an explicit approach. Create a dictionary that maps class names to
classes:
name2class = { "MyObject" : MyObject,
"MyOtherObjec
On Dec 29, 7:35 pm, Laszlo Nagy wrote:
> > Thanks for reply, but it doesn't fit to my task. If I will add later
> > other objects(and it will be very often) - I should stop the service,
> > but that would be very bad.
>
> I think you meant "if you add other classes".> I'm not sure, if this is
> s
Thanks for reply, but it doesn't fit to my task. If I will add later
other objects(and it will be very often) - I should stop the service,
but that would be very bad.
I think you meant "if you add other classes".
I'm not sure, if this is solution, but test passed:
myimportmod = __import__(
On 28 дек, 18:29, "Martin v. Loewis" wrote:
> Миклухо wrote:
> > Hi, all. My problem is:
> > 1) I have a database(postgresql)
> > 2)I'm getting some string from database(string is a classname -
> > written by me).
> > 3)I need to construct new object from this string.
> > In java it's done by Clas
On 28 дек, 18:29, "Martin v. Loewis" wrote:
> Миклухо wrote:
> > Hi, all. My problem is:
> > 1) I have a database(postgresql)
> > 2)I'm getting some string from database(string is a classname -
> > written by me).
> > 3)I need to construct new object from this string.
> > In java it's done by Clas
On 28 дек, 18:29, "Martin v. Loewis" wrote:
> Миклухо wrote:
> > Hi, all. My problem is:
> > 1) I have a database(postgresql)
> > 2)I'm getting some string from database(string is a classname -
> > written by me).
> > 3)I need to construct new object from this string.
> > In java it's done by Clas
On 28 дек, 18:02, Daniel Fetchinson wrote:
> > Hi, all. My problem is:
> > 1) I have a database(postgresql)
> > 2)I'm getting some string from database(string is a classname -
> > written by me).
> > 3)I need to construct new object from this string.
> > In java it's done by Class.forName().newIns
>> name2class = { "MyObject" : MyObject,
>>"MyOtherObject" : MyOtherObject,
>>"Etc" : Etc }
>>
>> Then, when you receive the string class_name, you do
>>
>> o = name2class[class_name]
>> o.myfunction()
>>
> The class needs to be instantiated, so the one line should b
On Dec 28, 7:29 am, "Martin v. Loewis" wrote:
>
> In this case (you just started to learn Python), I recommend to take
> an explicit approach. Create a dictionary that maps class names to
> classes:
>
> name2class = { "MyObject" : MyObject,
> "MyOtherObject" : MyOtherObject,
>
Миклухо wrote:
> Hi, all. My problem is:
> 1) I have a database(postgresql)
> 2)I'm getting some string from database(string is a classname -
> written by me).
> 3)I need to construct new object from this string.
> In java it's done by Class.forName().newInstance();
>
> For instance:
> 1)I receive
> Hi, all. My problem is:
> 1) I have a database(postgresql)
> 2)I'm getting some string from database(string is a classname -
> written by me).
> 3)I need to construct new object from this string.
> In java it's done by Class.forName().newInstance();
>
> For instance:
> 1)I receive the string: "My
11 matches
Mail list logo