Skip to content

Should cubelists contain objects that are not cubes? #1897

@rcomer

Description

@rcomer

Due to a somewhat noddy coding error, I learned that it is possible to add None to a cubelist via the append method. This leads to subsequent code breaking with a confusing error message.

I think it would be straightforward to add a check into CubeList.append so that it only takes a cube. I'd be happy to have a go at a PR to do this, but I noticed the comment in CubeList.__new__, which suggests that this was thought about but not done. Is there a reason why restricting the append method would be a bad idea?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions