{"library":"fastcore","title":"fastcore","description":"fastcore is a Python library that 'supercharges' Python for fastai development, but is useful independently. It extends Python with features inspired by other languages like multiple dispatch from Julia, mixins from Ruby, and utilities for functional programming and parallel processing. It aims to eliminate boilerplate and add useful functionality for common tasks, with frequent patch releases.","status":"active","version":"1.12.34","language":"en","source_language":"en","source_url":"https://github.com/AnswerDotAI/fastcore/","tags":["utility","development","fastai","functional programming","extensions","boilerplate reduction"],"install":[{"cmd":"pip install fastcore","lang":"bash","label":"PyPI"},{"cmd":"conda install fastcore -c fastai","lang":"bash","label":"Conda (recommended)"}],"dependencies":[],"imports":[{"note":"This is the recommended way to import fastcore for convenience, as the library is designed to allow safe `import *` by defining `__all__` in its modules.","symbol":"fastcore.all","correct":"from fastcore.all import *"},{"note":"The `typedispatch` system is being replaced by `plum-dispatch`. Users should migrate to `plum` for multiple dispatch functionality.","wrong":"from fastcore.dispatch import typedispatch","symbol":"typedispatch","correct":"from plum import dispatch"}],"quickstart":{"code":"import time\nfrom fastcore.all import *\n\n# L: An enhanced list-like object with many utility methods\nl_data = L(range(10)).shuffle()\nprint(f\"Original L: {l_data}\")\nprint(f\"Filtered (>=5): {l_data.filter(ge(5))}\") # 'ge' is an operator function from fastcore.all\n\n# parallel: Easily run functions in parallel\ndef slow_square(x):\n    time.sleep(0.01) # Simulate some work\n    return x*x\n\nresults = parallel(slow_square, l_data, n_workers=2)\nprint(f\"Parallel squared results: {results}\")\n\n# store_attr and basic_repr: Reduce boilerplate in classes\nclass MyClass:\n    def __init__(self, a, b=10):\n        store_attr() # Automatically stores 'a' and 'b' as self.a, self.b\n\n    __repr__ = basic_repr('a,b') # Generates a clean __repr__\n\nobj = MyClass(5, b=20)\nprint(f\"MyClass instance: {obj}\")","lang":"python","description":"This quickstart demonstrates key `fastcore` utilities: the `L` collection for enhanced list operations, the `parallel` function for easy multiprocessing, and `store_attr` and `basic_repr` for reducing class boilerplate."},"warnings":[{"fix":"Install `plum-dispatch` (`pip install plum-dispatch`) and update imports from `fastcore.dispatch` to `plum` (e.g., `from plum import dispatch`). If using `TypeDispatch` classes, switch to `plum.Function`.","message":"The multiple dispatch system (`@typedispatch`, `TypeDispatch`) in `fastcore.dispatch` is being replaced by the `plum-dispatch` library. Code relying on fastcore's internal dispatch system will need to be updated.","severity":"breaking","affected_versions":"Versions where Plum integration began (check fastcore.fast.ai documentation for specifics)."},{"fix":"For potentially costly or side-effecting default values, use the standard Python conditional expression `b if a is None else a` directly, or ensure that `b` is pre-computed or a simple literal.","message":"The `fastcore.all.ifnone(a, b)` function eagerly evaluates both `a` and `b`. This differs from Python's standard `b if a is None else a` conditional expression, which short-circuits and only evaluates `b` if `a` is `None`. This can lead to unexpected side effects or performance issues if `b` is a complex or side-effecting operation.","severity":"gotcha","affected_versions":"All versions."}],"env_vars":null,"last_verified":"2026-04-05T00:00:00.000Z","next_check":"2026-07-04T00:00:00.000Z"}