(Correction: I meant TypedDict).

On Fri, Aug 21, 2020 at 3:03 PM Graham Wheeler <gram@geekraver.com> wrote:
Hi all

I have been looking at writing typings for sklearn and am wondering if there is a good solution for https://scikit-learn.org/stable/modules/generated/sklearn.utils.Bunch.html

Clearly it can be typed as just the class itself; however, there are many examples with sklearn that start with loading a sample dataset, in which case the specific members are useful to specify. For example:

    from sklearn.datasets import load_iris

    iris = load_iris()
    X = iris.data
    y = iris.target

NamedDictionary seems about the closest but its not ideal. Protocols might be another option. Wondering if there is a better solution.

This might be useful at some point in doing dynamic typing of things like pandas DataFrames where columns could be treated in a similar way (e.g. in a live environment like a Jupyter notebook).

Thanks
Graham
_______________________________________________
Typing-sig mailing list -- typing-sig@python.org
To unsubscribe send an email to typing-sig-leave@python.org
https://mail.python.org/mailman3/lists/typing-sig.python.org/
Member address: gram@geekraver.com