Re: Python C api: create a new object class

2009-11-11 Thread samwyse
On Nov 10, 1:09 pm, "lallous" wrote: > Hello > > I have 3 questions, hope someone can help: > > 1) > How can I create an instance class in Python, currently I do: > > class empty: >   pass > > Then anytime I want that class (which I treat like a dictionary): > > o = empty() > o.myattr = 1 > etc...

Re: Python C api: create a new object class

2009-11-10 Thread Benjamin Peterson
lallous lgwm.org> writes: > Is there is a one line syntax to instantiate an instance? You can't instantiate an instance; it's already instantiated. > > Any other ways than this: > o = new.classobj('object', (), {}) class x: pass > How can I, similarly, create an object "o" in C api: Use PyOb

Re: Python C api: create a new object class

2009-11-10 Thread Martin v. Löwis
> How can I create an instance class in Python, currently I do: > > class empty: > pass > > Then anytime I want that class (which I treat like a dictionary): > > o = empty() > o.myattr = 1 > etc > > Is there is a one line syntax to instantiate an instance? > > Any other ways than this: >

Python C api: create a new object class

2009-11-10 Thread lallous
Hello I have 3 questions, hope someone can help: 1) How can I create an instance class in Python, currently I do: class empty: pass Then anytime I want that class (which I treat like a dictionary): o = empty() o.myattr = 1 etc Is there is a one line syntax to instantiate an instance? A