From: Noel O'B. <bao...@gm...> - 2007-11-19 14:56:44
|
On 19/11/2007, Karol Langner <kar...@kn...> wrote: > On Monday 19 November 2007 15:21, Noel O'Boyle wrote: > > On 19/11/2007, Karol Langner <kar...@kn...> wrote: > > > On Monday 19 November 2007 14:38, Noel O'Boyle wrote: > > > > Do we really need support for three JSON libraries? We can just bundle > > > > simplejson (or one of the others if their licenses permit) with cclib. > > > > > > I don't like it either, but it seems to be the simplest fix for now if I > > > want to use cjson. Bundling is probably the best final solution. I would > > > opt for cjson in that case, although it is a C extension and would > > > require compilation upon install, which cclib has avoided up to now. > > > > Yes - I wouldn't like to do this for the 'core' parsing. > > Does this mean you would consider C extensions appropriate for ex. > cclib.methods if they made them ore efficient? I think I've answered this on another thread a few weeks ago. The short answer is yes. > > How about > > changing so that rather than passing in a module, you just pass in the > > dump/load function? Then cclib wouldn't have to do any of this. The > > user would do "from simplejson import dumps", and then pass "dumps" as > > a parameter to write_json. > > I'm not sure I understand: you propose to bundle a pure python JSON module for > the default (simplejson or json), and add an optional dumps/loads argument if > the user wants an alternate function? Maybe - what do you think? Alternatively, we could forget about bundling or importing the module ourselves, and just leave it to the user to pass in the dumps/loads function. This would make our code much cleaner, and fits the "Only one good way to do it" philosophy of Python. I will go with this as my final proposal... > - Karol > > -- > written by Karol Langner > Mon Nov 19 15:36:43 CET 2007 > |