[issue14588] PEP 3115 compliant dynamic class creation

2012-05-19 Thread Roundup Robot
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset befd56673c80 by Nick Coghlan in branch 'default': Close #14588: added a PEP 3115 compliant dynamic type creation mechanism http://hg.python.org/cpython/rev/befd56673c80 -- nosy: +python-dev resolution: -

[issue14588] PEP 3115 compliant dynamic class creation

2012-05-19 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: Great doc patch. I think it would be worthwhile to backport it. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14588 ___

[issue14588] PEP 3115 compliant dynamic class creation

2012-05-12 Thread Daniel Urban
Daniel Urban urban.dani...@gmail.com added the comment: Here is my first attempt at creating a pure Python version of the operator.build_class function (in my previous patch) as types.new_class. The three added functions (two private and one public) correspond to the following functions in my

[issue14588] PEP 3115 compliant dynamic class creation

2012-05-11 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: Implementing in pure Python seems to have a lot of pros and no con to me. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14588 ___

[issue14588] PEP 3115 compliant dynamic class creation

2012-05-10 Thread Nick Coghlan
Nick Coghlan ncogh...@gmail.com added the comment: Based on the python-dev thread [1], the proposed name for this API is now types.new_class(). This parallels the existing imp.new_module() naming scheme and avoids various problems with the idea of using a static method on type itself

[issue14588] PEP 3115 compliant dynamic class creation

2012-05-07 Thread Nick Coghlan
Nick Coghlan ncogh...@gmail.com added the comment: In going to add documentation for your patch, I realised the operator module is not the right place for this. The types module actually seems like the most appropriate home, but that will require adding a _types module to back it. I'll post

[issue14588] PEP 3115 compliant dynamic class creation

2012-04-20 Thread Daniel Urban
Daniel Urban urban.dani...@gmail.com added the comment: I've attached the third patch with the eval_body - exec_body change; explicitly passing the default (None) now also allowed. I also fixed a refleak (I think). -- Added file:

[issue14588] PEP 3115 compliant dynamic class creation

2012-04-19 Thread Daniel Urban
Daniel Urban urban.dani...@gmail.com added the comment: Fair enough. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14588 ___ ___

[issue14588] PEP 3115 compliant dynamic class creation

2012-04-19 Thread Nick Coghlan
Nick Coghlan ncogh...@gmail.com added the comment: It occurs to me that, for naming consistency, the callback arg should be documented as exec_body rather than eval_body. I'll try to get to a proper patch review this weekend. -- ___ Python tracker

[issue14588] PEP 3115 compliant dynamic class creation

2012-04-19 Thread R. David Murray
Changes by R. David Murray rdmur...@bitdance.com: -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14588 ___ ___

[issue14588] PEP 3115 compliant dynamic class creation

2012-04-18 Thread Daniel Urban
Daniel Urban urban.dani...@gmail.com added the comment: I've attached a patch with more tests. I simply copied and modified the tests about metaclass calculation and __prepare__ in test_descr.py, to create the tested classes with operator.build_class (and not the class statement). Although,

[issue14588] PEP 3115 compliant dynamic class creation

2012-04-18 Thread Nick Coghlan
Nick Coghlan ncogh...@gmail.com added the comment: I thought about that, and I'd prefer a dedicated dictionary to avoid questions of name conflicts. Wrapping the keyword args in a dict() call is still pretty clean: C = operator.build_class('C', (A, B), dict(metaclass=MyMeta)) --

[issue14588] PEP 3115 compliant dynamic class creation

2012-04-16 Thread R. David Murray
Changes by R. David Murray rdmur...@bitdance.com: -- assignee: - ncoghlan ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14588 ___ ___

[issue14588] PEP 3115 compliant dynamic class creation

2012-04-16 Thread Éric Araujo
Changes by Éric Araujo mer...@netwok.org: -- nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14588 ___ ___ Python-bugs-list

[issue14588] PEP 3115 compliant dynamic class creation

2012-04-15 Thread Daniel Urban
: 158382 nosy: durban, ncoghlan priority: normal severity: normal status: open title: PEP 3115 compliant dynamic class creation type: enhancement versions: Python 3.3 Added file: http://bugs.python.org/file25231/operator_build_class.patch ___ Python tracker rep

Re: Dynamic Class Creation

2010-04-02 Thread Aahz
In article 8d79f0cb-9c5b-4243-8891-a15fb311f...@z18g2000prh.googlegroups.com, Josh English joshua.r.engl...@gmail.com wrote: market code='anlg' tier='ProMarket' mail='True' title field=prefAnalog Science Fiction and Fact/title nicknameAnalog/nickname keywordScience Fiction/keyword

Re: Dynamic Class Creation

2010-03-17 Thread Josh English
Chris, Thanks. This worked for the attributes, but I think the tactic is still misleading. There are child elements I can't quite determine how to deal with: market code='anlg' tier='ProMarket' mail='True' title field=prefAnalog Science Fiction and Fact/title nicknameAnalog/nickname

Re: Dynamic Class Creation

2010-03-17 Thread Gerard Flanagan
Josh English wrote: Chris, Thanks. This worked for the attributes, but I think the tactic is still misleading. There are child elements I can't quite determine how to deal with: market code='anlg' tier='ProMarket' mail='True' title field=prefAnalog Science Fiction and Fact/title

Dynamic Class Creation

2010-03-16 Thread Josh English
I have a large program with lots of data stored in XML. I'm upgrading my GUI to use ObjectListView, but with my data in XML, I don't have regular objects to interact with the OLV. I do have an XML validator that defines the structure of the XML elements, and I'm trying to dynamically create a

Re: Dynamic Class Creation

2010-03-16 Thread Chris Rebert
On Mon, Mar 15, 2010 at 11:01 PM, Josh English joshua.r.engl...@gmail.com wrote: I have a large program with lots of data stored in XML. I'm upgrading my GUI to use ObjectListView, but with my data in XML, I don't have regular objects to interact with the OLV. I do have an XML validator that

Re: Dynamic Class Creation

2010-03-16 Thread Jack Diederich
On Tue, Mar 16, 2010 at 2:18 AM, Chris Rebert c...@rebertia.com wrote: On Mon, Mar 15, 2010 at 11:01 PM, Josh English joshua.r.engl...@gmail.com wrote: I have a large program with lots of data stored in XML. I'm upgrading my GUI to use ObjectListView, but with my data in XML, I don't have

Re: Dynamic Class Creation

2010-03-16 Thread Chris Rebert
On Tue, Mar 16, 2010 at 9:49 AM, Jack Diederich jackd...@gmail.com wrote: On Tue, Mar 16, 2010 at 2:18 AM, Chris Rebert c...@rebertia.com wrote: On Mon, Mar 15, 2010 at 11:01 PM, Josh English joshua.r.engl...@gmail.com wrote: snip What's the best way to create these helper methods? You can