[Python-Dev] what license for a module derived from Objects/dictobjec.c
I would like to get some advice on which license to include/refer to in my setup.py (and probably the source files). This is for an extension module that is clearly (for the knowledgeable) derived from Python's Objects/dictobject.c and Include/dictobject.h. I first of all don't want to infringe any original license on that code. I second would like to make sure the license for code is not a problem to make it into Linux distributions like Ubuntu/Debian (assuming of course the code is acceptable and fills enough of a gap that these distros want to pick it up in the first place). And thirdly, I although I would like my name to be associated on further derivations of this module, that is not a strict requirement. Should I refer to MIT, LGPL or BSD. Any particular copy of a license I should put up on my website and refer to with a URL? Any examples or references with a brief explanation would be much appreciated. I know I could look at what other modules use, but at this point I rather spent time on finishing implementing the "insert" method (and some tests) and getting my first release out (and hopefullysome feedback), than comparing other modules for the license they chose and try to deduct what I should use/specify for a license. Thanks in advance Anthon For the curious: the module is called ordereddict. It is an implemenation in C of a dictionary with ordered keys based on Key Insertion Order. Value updating of existing Key/Value pairs does not reorder the keys, although I probably implement that as an (instantiation) option after the initial version. orderdict() does all that dict() does, except for instantiation it will only take another ordereddict() (not a dict) or an ordered list of pairs. Some extras (reverse(), index()) are already implemented and work like Larosa/Foord's odict.OrderedDict() (theirs is also the example I took for the representation of the ordereddict). ordereddict() is 5-10% slower than dict() (especially key deletion is 'expensive') and it is 5-9 times faster than odict.OrderedDict() I have done all of the development under Linux but will be proably be able to test things under Windows and may, at some point even dig up my old G4 to see how things go on OS X. I am fairly confident that the C code is still portable, or close to it. ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Proposal: add odict to collections
Sorry to pipe in so late, but this is actually the default behaviour of my C implementation (which I call KIO (Key Insertion Order), there is an option to change this to KVIO (Key (or) Value Insertion Order), which moves the pair to the end. Anthon Armin Ronacher wrote: > Steven D'Aprano pearwood.info> writes: > >> Conceptually, I would expect the following behaviour: >> > od = odict() > od[1] = 'spam' # insert a new key > od[2] = 'parrot' # insert a new key > od[1] = 'ham' # modify existing key > od.items() >> [(1, 'ham'), (2, 'parrot')] > That behavior is different to any ordered-dict implementation > out there ;-) > > Regards, > Armin > > ___ > Python-Dev mailing list > Python-Dev@python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > http://mail.python.org/mailman/options/python-dev/anthon%40mnt.org > > ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] switching on -3 from within a program?
With a minor modification to the Makefile I was able to get mod_wsgi v2.3 to work with python2.6rc1. I promptly got a warning in my apache log files on the depcrecated use of 'sha' in the paste's cookie module, good! And easily fixed. After that I was looking for a way to switch on the -3 warnings from within my code to have extra warnings show up in my apache log file. After reading some documentation I tried from the python2.6 prompt: import sys sys.py3kwarning = True x = { 'abc': 1 }; x.has_key('abc') which does not give a warning (starting python2.6 with the -3 option of course does). Is there anyway to switch this on from within a program with a Python statement? If not, would I need to make a small C-extension module (to be imported as the first module) that sets Py_Py3WarningFlag or something else at the C level, or would that better be done by mod_wsgi's C code. Regards Anthon ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] switching on -3 from within a program?
Hi Nick, I am aware of that (but others might not, so you are right to point this out). I did follow both Christian's and Benjamin's suggestions. The implementation at the mod_wsgi C level, which is before any module loading is more permanent, but the ctypes trick doesn't require an apache2 restart, which is somewhat more comfortable. Anthon Nick Coghlan wrote: > Benjamin Peterson wrote: >> def engage_py3k_warning(): >> flag = ctypes.c_int.in_dll(ctypes.pythonapi, "Py_Py3kWarningFlag") >> flag.value = 1 > > Note that tricks like this won't necessarily enable all python 3 > warnings for modules that have been imported before the flag gets set. > To avoid unnecessary performance penalties as a result of Py3k warnings, > modules are permitted to do things like: > > def func(): > # Do whatever > > if sys.py3kwarning: > _orig_func = func > def func(): > warnings.py3kwarn("Goes away in 3.0") > _orig_func() > > Modules that are first imported after the flag has been set will > obviously have all of their warnings properly enabled. > > Cheers, > Nick. > > ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com