mrocklin: This looks good to me.  I was surprised to see that serializing `(slice, [...])` was as fast (or faster) as serializing `slice(...)`
diff --git a/dask/dataframe/io/io.py b/dask/dataframe/io/io.py
index 93b47bb3c..5c82683aa 100644
--- a/dask/dataframe/io/io.py
+++ b/dask/dataframe/io/io.py
@@ -343,7 +343,7 @@ def dataframe_from_ctable(x, slc, columns=None, categories=None, lock=lock):
 
 
 def from_dask_array(x, columns=None):
-    """ Create Dask Array from a Dask DataFrame
+    """ Create a Dask DataFrame from a Dask Array.
 
     Converts a 2d array into a DataFrame and a 1d array into a Series.
 
diff --git a/dask/delayed.py b/dask/delayed.py
index a9cd531e0..8f0943d0d 100644
--- a/dask/delayed.py
+++ b/dask/delayed.py
@@ -64,26 +64,33 @@ def to_task_dask(expr):
     """
     if isinstance(expr, Delayed):
         return expr.key, expr.dask
+
     if isinstance(expr, base.Base):
         name = 'finalize-' + tokenize(expr, pure=True)
         keys = expr._keys()
         dsk = expr._optimize(ensure_dict(expr.dask), keys)
         dsk[name] = (expr._finalize, (concrete, keys))
         return name, dsk
-    if isinstance(expr, tuple) and type(expr) != tuple:
-        return expr, {}
-    if isinstance(expr, (Iterator, list, tuple, set)):
+
+    if isinstance(expr, Iterator):
+        expr = list(expr)
+    typ = type(expr)
+
+    if typ in (list, tuple, set):
         args, dasks = unzip((to_task_dask(e) for e in expr), 2)
         args = list(args)
         dsk = sharedict.merge(*dasks)
         # Ensure output type matches input type
-        if isinstance(expr, (tuple, set)):
-            return (type(expr), args), dsk
-        else:
-            return args, dsk
-    if type(expr) is dict:
+        return (args, dsk) if typ is list else ((typ, args), dsk)
+
+    if typ is dict:
         args, dsk = to_task_dask([[k, v] for k, v in expr.items()])
         return (dict, args), dsk
+
+    if typ is slice:
+        args, dsk = to_task_dask([expr.start, expr.stop, expr.step])
+        return (slice,) + tuple(args), dsk
+
     return expr, {}
 
 

Slicing delayed objects with delayed objects does not work
I'm trying to wrap my code with delayed, using `dask 0.15.0`, `python 3.6.0` and `numpy 1.12.1`, but I stumbled on an exception.
```
from dask import delayed
import numpy as np
a = delayed(np.arange(10))
b = delayed(2)

a[:b].compute()
```
results in: `TypeError: slice indices must be integers or None or have an __index__ method`

```
a[delayed(slice)(None,b)].compute()
```
Works, even only calling `slice(None,b)` gives no error, but then again `a[slice(None,b)]` gives an identical error. Isn't it to be expected that a delayed object would wrap its own slice objects when sliced?






diff --git a/dask/tests/test_delayed.py b/dask/tests/test_delayed.py
index 837e739a4..8c89cca23 100644
--- a/dask/tests/test_delayed.py
+++ b/dask/tests/test_delayed.py
@@ -1,4 +1,4 @@
-from collections import Iterator, namedtuple
+from collections import namedtuple
 from operator import add, setitem
 import pickle
 from random import random
@@ -32,6 +32,10 @@ def test_to_task_dask():
     assert task == x
     assert dict(dask) == {}
 
+    task, dask = to_task_dask(slice(a, b, 3))
+    assert task == (slice, 'a', 'b', 3)
+    assert dict(dask) == merge(a.dask, b.dask)
+
     # Issue https://github.com/dask/dask/issues/2107
     class MyClass(dict):
         pass
@@ -58,6 +62,8 @@ def test_operators():
     a = delayed([1, 2, 3])
     assert a[0].compute() == 1
     assert (a + a).compute() == [1, 2, 3, 1, 2, 3]
+    b = delayed(2)
+    assert a[:b].compute() == [1, 2]
 
     a = delayed(10)
     assert (a + 1).compute() == 11
@@ -154,7 +160,6 @@ def test_lists_are_concrete():
     assert c.compute() == 20
 
 
-@pytest.mark.xfail
 def test_iterators():
     a = delayed(1)
     b = delayed(2)
@@ -163,7 +168,6 @@ def test_iterators():
     assert c.compute() == 3
 
     def f(seq):
-        assert isinstance(seq, Iterator)
         return sum(seq)
 
     c = delayed(f)(iter([a, b]))

pip install -e .[complete]
parse_log_pytest
pytest
pytest pytest-cov pytest-xdist pytest-mock pytest-asyncio
apt-get update apt-get install -y gcc
3.6
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
aiobotocore==2.1.2
aiohttp==3.8.6
aioitertools==0.11.0
aiosignal==1.2.0
async-timeout==4.0.2
asynctest==0.13.0
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
botocore==1.23.24
certifi==2021.5.30
charset-normalizer==3.0.1
click==8.0.4
cloudpickle==2.2.1
coverage==6.2
-e git+https://github.com/dask/dask.git@ecdae84aa3b8ee5408876b0b7d7eade3d127e177#egg=dask
distributed==1.19.3
execnet==1.9.0
frozenlist==1.2.0
fsspec==2022.1.0
HeapDict==1.0.1
idna==3.10
idna-ssl==1.1.0
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
jmespath==0.10.0
locket==1.0.0
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
msgpack-python==0.5.6
multidict==5.2.0
numpy==1.19.5
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
pandas==1.1.5
partd==1.2.0
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
psutil==7.0.0
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
pytest-asyncio==0.16.0
pytest-cov==4.0.0
pytest-mock==3.6.1
pytest-xdist==3.0.2
python-dateutil==2.9.0.post0
pytz==2025.2
s3fs==2022.1.0
six==1.17.0
sortedcontainers==2.4.0
tblib==1.7.0
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
tomli==1.2.3
toolz==0.12.0
tornado==6.1
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
urllib3==1.26.20
wrapt==1.16.0
yarl==1.7.2
zict==2.1.0
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work

name: dask
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - attrs=21.4.0=pyhd3eb1b0_0
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - importlib-metadata=4.8.1=py36h06a4308_0
  - importlib_metadata=4.8.1=hd3eb1b0_0
  - iniconfig=1.1.1=pyhd3eb1b0_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - more-itertools=8.12.0=pyhd3eb1b0_0
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - packaging=21.3=pyhd3eb1b0_0
  - pip=21.2.2=py36h06a4308_0
  - pluggy=0.13.1=py36h06a4308_0
  - py=1.11.0=pyhd3eb1b0_0
  - pyparsing=3.0.4=pyhd3eb1b0_0
  - pytest=6.2.4=py36h06a4308_2
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - toml=0.10.2=pyhd3eb1b0_0
  - typing_extensions=4.1.1=pyh06a4308_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zipp=3.6.0=pyhd3eb1b0_0
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - aiobotocore==2.1.2
      - aiohttp==3.8.6
      - aioitertools==0.11.0
      - aiosignal==1.2.0
      - async-timeout==4.0.2
      - asynctest==0.13.0
      - botocore==1.23.24
      - charset-normalizer==3.0.1
      - click==8.0.4
      - cloudpickle==2.2.1
      - coverage==6.2
      - distributed==1.19.3
      - execnet==1.9.0
      - frozenlist==1.2.0
      - fsspec==2022.1.0
      - heapdict==1.0.1
      - idna==3.10
      - idna-ssl==1.1.0
      - jmespath==0.10.0
      - locket==1.0.0
      - msgpack-python==0.5.6
      - multidict==5.2.0
      - numpy==1.19.5
      - pandas==1.1.5
      - partd==1.2.0
      - psutil==7.0.0
      - pytest-asyncio==0.16.0
      - pytest-cov==4.0.0
      - pytest-mock==3.6.1
      - pytest-xdist==3.0.2
      - python-dateutil==2.9.0.post0
      - pytz==2025.2
      - s3fs==2022.1.0
      - six==1.17.0
      - sortedcontainers==2.4.0
      - tblib==1.7.0
      - tomli==1.2.3
      - toolz==0.12.0
      - tornado==6.1
      - urllib3==1.26.20
      - wrapt==1.16.0
      - yarl==1.7.2
      - zict==2.1.0
prefix: /opt/conda/envs/dask

dask/tests/test_delayed.py::test_to_task_dask dask/tests/test_delayed.py::test_operators
dask/tests/test_delayed.py::test_delayed dask/tests/test_delayed.py::test_methods dask/tests/test_delayed.py::test_attributes dask/tests/test_delayed.py::test_method_getattr_optimize dask/tests/test_delayed.py::test_delayed_errors dask/tests/test_delayed.py::test_common_subexpressions dask/tests/test_delayed.py::test_lists dask/tests/test_delayed.py::test_literates dask/tests/test_delayed.py::test_literates_keys dask/tests/test_delayed.py::test_lists_are_concrete dask/tests/test_delayed.py::test_iterators dask/tests/test_delayed.py::test_traverse_false dask/tests/test_delayed.py::test_pure dask/tests/test_delayed.py::test_pure_global_setting dask/tests/test_delayed.py::test_nout dask/tests/test_delayed.py::test_kwargs dask/tests/test_delayed.py::test_array_delayed dask/tests/test_delayed.py::test_array_bag_delayed dask/tests/test_delayed.py::test_delayed_picklable dask/tests/test_delayed.py::test_delayed_compute_forward_kwargs dask/tests/test_delayed.py::test_delayed_method_descriptor dask/tests/test_delayed.py::test_delayed_callable dask/tests/test_delayed.py::test_delayed_name_on_call dask/tests/test_delayed.py::test_callable_obj dask/tests/test_delayed.py::test_name_consistent_across_instances dask/tests/test_delayed.py::test_sensitive_to_partials dask/tests/test_delayed.py::test_delayed_name dask/tests/test_delayed.py::test_finalize_name
dask/delayed.py dask/dataframe/io/io.py
dask/delayed.py dask/dataframe/io/io.py