Skip to content

Group.create in V2 vs V3 #1928

@rabernat

Description

@rabernat

In V2, the way you create an array with a Group is

import zarr
root = zarr.open_group('data/example.zarr', mode='w')
array = root.create("foo", shape=10)

https://zarr.readthedocs.io/en/stable/api/hierarchy.html#zarr.hierarchy.Group.create

V3 Groups also have a create method; but it is a class method to create a new group

import zarr
root = zarr.Group.create(store)
# new syntax for creating an array
array = root.create_array("foo", ...)
# old syntax doesn't work...tries to create another group!
root.create('foo', shape=(10,))
# -> TypeError: Group.create() got an unexpected keyword argument 'shape'

I predict this is going to be a big source of confusion with V3. We should think about how to minimize the pain.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions