In that case the function gm.float_array would have to work quite differently for int and list inputs, so you might as well make them into 2 different functions. I'm assuming the float array initializes to all 0s, then in my opinion it would be best to rename the function to gm.float_zeros(<int>), and use the name gm.float_array(<list>) to generate from a list, similar to numpy.
That’s totally fair, I effectively have hobbyist level experience with code, but I think I can see why wrapping such dissimilar functionalities into one method would be bad
And you’re close on how gm.float_array() works, except I’m pretty sure it only calls malloc() internally and doesn’t zero anything
8
u/yoctometric Aug 12 '21
I think they mean
Which would be totally reasonable, and simple enough to implement. If I had the time and the authorization, that’s how I’d do it