From 1e313a243ca5785817ba6777ab862477cd9944bc 2015-03-20 14:03:18 From: Min RK Date: 2015-03-20 14:03:18 Subject: [PATCH] Merge pull request #7977 from quantopian/its-default-value-not-default DOC: Warn the user when they pass `default` to a TraitType. --- diff --git a/IPython/utils/traitlets.py b/IPython/utils/traitlets.py index c69aeeb..e124971 100644 --- a/IPython/utils/traitlets.py +++ b/IPython/utils/traitlets.py @@ -51,6 +51,7 @@ try: ClassTypes = (ClassType, type) except: ClassTypes = (type,) +from warnings import warn from .importstring import import_item from IPython.utils import py3compat @@ -330,6 +331,13 @@ class TraitType(object): if allow_none is not None: self.allow_none = allow_none + if 'default' in metadata: + # Warn the user that they probably meant default_value. + warn( + "Parameter 'default' passed to TraitType. " + "Did you mean 'default_value'?" + ) + if len(metadata) > 0: if len(self.metadata) > 0: self._metadata = self.metadata.copy()