2 new revisions:
Revision: bf3204c3e5fc
Branch: dev
Author: felix.antoine.fortin
Date: Wed Apr 2 12:53:51 2014 UTC
Log: Add warning to the creator if a class with the same name already
exist...
http://code.google.com/p/deap/source/detail?r=bf3204c3e5fc
Revision: 8d67e987d56a
Branch: dev
Author: felix.antoine.fortin
Date: Wed Apr 2 12:55:08 2014 UTC
Log: Merge.
http://code.google.com/p/deap/source/detail?r=8d67e987d56a
==============================================================================
Revision: bf3204c3e5fc
Branch: dev
Author: felix.antoine.fortin
Date: Wed Apr 2 12:53:51 2014 UTC
Log: Add warning to the creator if a class with the same name already
exist in the module.
http://code.google.com/p/deap/source/detail?r=bf3204c3e5fc
Modified:
/deap/creator.py
=======================================
--- /deap/creator.py Sat Feb 15 15:13:05 2014 UTC
+++ /deap/creator.py Wed Apr 2 12:53:51 2014 UTC
@@ -23,6 +23,7 @@
import array
import copy
+import warnings
class_replacers = {}
"""Some classes in Python's standard library as well as third party library
@@ -123,6 +124,13 @@
The :ref:`creating-types` tutorial gives more examples of the creator
usage.
"""
+
+ if classname in globals():
+ warnings.warn("A class named '{0}' has already been created and
it "
+ "will be overwritten. Consider deleting previous "
+ "creation of that class or rename
it.".format(classname),
+ RuntimeWarning)
+
dict_inst = {}
dict_cls = {}
for obj_name, obj in kargs.iteritems():
==============================================================================
Revision: 8d67e987d56a
Branch: dev
Author: felix.antoine.fortin
Date: Wed Apr 2 12:55:08 2014 UTC
Log: Merge.
http://code.google.com/p/deap/source/detail?r=8d67e987d56a