diff --git a/pandas/core/config_init.py b/pandas/core/config_init.py index 70f3fb045376e..6a51ec731675c 100644 --- a/pandas/core/config_init.py +++ b/pandas/core/config_init.py @@ -238,3 +238,56 @@ def use_inf_as_null_cb(key): with cf.config_prefix('mode'): cf.register_option('use_inf_as_null', False, use_inf_as_null_doc, cb=use_inf_as_null_cb) + + +sb_xp_foo_doc = """ +: boolean + Enables a snazzy, but not yet stable feature that could use + some feedback before going into core. +""" + +def sandbox(gh_issue_num,msg=None): + def inner(cb): + def f(key): + + s = """ +This is an experimental feature being considered for inclusion in pandas core. +We'd appreciate your feedback on it in the Github issue page: + + http://github.com/pydata/pandas/issues/%d + +If you find this useful, lacking in major functionality or buggy please +take a moment to let us know, so we can make pandas (even) better. + +Thank you, + +The Pandas dev team + +""" % gh_issue_num + + if msg: + s += "P.S.\n\n" + msg + + # don't print( the msessage on turn off + val = cf.get_option(key) + if val: + print(s) + + return cb(key) + + return f + return inner + +@sandbox(3274,msg= "love the hair.") +def xp_foo_cb(key): + import pandas + val = cf.get_option(key) + if val: + from pandas.sandbox.xp import foo + pandas.DataFrame.foo = foo + else: + del pandas.DataFrame.foo + +with cf.config_prefix('sandbox'): + cf.register_option('experimental_feature', False, sb_xp_foo_doc, + validator=is_bool, cb=xp_foo_cb) diff --git a/pandas/sandbox/xp/__init__.py b/pandas/sandbox/xp/__init__.py new file mode 100644 index 0000000000000..5ec592fb98c79 --- /dev/null +++ b/pandas/sandbox/xp/__init__.py @@ -0,0 +1,4 @@ + +# monkey patched onto something, when the config options is enabled +def foo(self): + print "Hi, I'm an experimental new method. grrrr!" % type(self)