Skip to content

Don't hard-code allow_None to True in Array#726

Merged
maximlt merged 2 commits into
mainfrom
array_allow_none
Apr 12, 2023
Merged

Don't hard-code allow_None to True in Array#726
maximlt merged 2 commits into
mainfrom
array_allow_none

Conversation

@maximlt
Copy link
Copy Markdown
Member

@maximlt maximlt commented Apr 5, 2023

Fixes #583

This is effectively a breaking change. The code below used to work fine, while after this change p.a = None will raise an error.

import param, numpy as np

class P(param.Parameterized):
    a = param.Array(np.zeros((2, 2)))

p = P()

p.a = None

@maximlt maximlt added this to the 2.0 milestone Apr 5, 2023
@maximlt maximlt requested a review from jlstevens April 12, 2023 14:20
@jlstevens
Copy link
Copy Markdown
Contributor

Simple change and looks correct to me. Based on the discussion in #583, this is a breaking change but one we think makes sense for 2.0.

@maximlt
Copy link
Copy Markdown
Member Author

maximlt commented Apr 12, 2023

Thanks for the review! Merging.

@maximlt maximlt merged commit c96c1f4 into main Apr 12, 2023
@maximlt maximlt deleted the array_allow_none branch April 12, 2023 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Array should not force allow_None=True

2 participants