We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1ad6fe3 commit e2bc2a7Copy full SHA for e2bc2a7
sklearn/datasets/base.py
@@ -51,6 +51,9 @@ def __init__(self, **kwargs):
51
def __setattr__(self, key, value):
52
self[key] = value
53
54
+ def __dir__(self):
55
+ return self.keys()
56
+
57
def __getattr__(self, key):
58
try:
59
return self[key]
sklearn/datasets/tests/test_base.py
@@ -223,3 +223,9 @@ def test_bunch_pickle_generated_with_0_16_and_read_with_0_17():
223
bunch_from_pkl.key = 'changed'
224
assert_equal(bunch_from_pkl.key, 'changed')
225
assert_equal(bunch_from_pkl['key'], 'changed')
226
227
228
+def test_bunch_dir():
229
+ # check that dir (important for autocomplete) shows attributes
230
+ data = load_iris()
231
+ assert_true("data" in dir(data))
0 commit comments