Allow int-like floats for particles
Description
model.settings.particles is quite often set to be large numbers that >=1e6. This makes it very annoying and error prone to specify as ints, since python treats all scientific notation as a float.
I propose that:
model.settings.particles = 1e6 be allowed but
model.seetings.particles = 1.23e1 not be allowed as it not close to an integer value.
Alternatives
Teach users to use 10_000_000 notation. This isn't ideal as it relies on users being aware of certain features and not making mistakes.
Compatibility
This should have little impact on the user facing API, but will impact the test suite.
Why not just have people use int(1e6)?
That is a viable alternative too but is very annoying IMO and I don't think an apparent solution to the average novice.
Would this change also cover the xmls? IIRC, in the xmls they also only accept integers and it is super annoying. Would definitely rather scientific
I have thought about that. I think I would like to implement that, but that would be a much larger scope of revising XML schema and updating the parsers. I'm not sure if that should be a whole separate issue to discuss or not.
I understand the motivation here but I would not personally be in favor of this change. The main problem to me is -- what about every other input in the API that is an integer? Should we allow those to take floats that are rounded to the nearest integer? To do so would be overkill, but to not do so would then be inconsistent. Writing either int(1e6) or 1_000_000 is very simple for a user and doesn't require us to overhaul the API or our XML format.
You're right that this would need to be uniform. This could be implemented universally. However, after thinking about it more and more this wouldn't be pythonic to implement.