<div dir="ltr"><div>Why not both? The definition of the enum might live in a proper namespace location, but I see no reason why `np.copy.IF_NEEDED = np.flags.CopyFlgs.IF_NEEDED` can't be done (I mean, adding the enum members as attributes to the `np.copy()` function). Seems perfectly reasonable to me, and reads pretty nicely, too. It isn't like we are dropping support for the booleans, so those are still around for easy typing.</div><div><br></div><div>Ben Root<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 23, 2021 at 10:26 PM Stefan van der Walt <<a href="mailto:stefanv@berkeley.edu">stefanv@berkeley.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Wed, Jun 23, 2021, at 18:01, Juan Nunez-Iglesias wrote:<br>
> Personally I was a fan of the Enum approach. People dislike it because <br>
> it is not “Pythonic”, but imho that is an accident of history because <br>
> Enums only appeared (iirc) in Python 3.4. In fact, they are the right <br>
> data structure for this particular problem, so for my money we should <br>
> *make it* Pythonic by starting to use it everywhere where we have a <br>
> finite list of choices.<br>
<br>
The enum definitely feels like the right abstraction. But the resulting API is clunky because of naming and top-level scarcity.<br>
<br>
Hence the suggestion to tag it onto np.copy, but there is an argument to be made for consistency by placing all enums under np.flags or similar.<br>
<br>
Still, np.flags.copy.IF_NEEDED gets long.<br>
<br>
Stéfan <br>
_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@python.org" target="_blank">NumPy-Discussion@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/numpy-discussion" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/numpy-discussion</a><br>
</blockquote></div>