On 10/14/2019 12:54 AM, Andrew Barnert via Python-ideas wrote:
On Oct 13, 2019, at 22:54, Chris Angelico <ros...@gmail.com> wrote:
Mathematically, what's the difference between '1' and '1+0j' (or '1+0i')?
Again, think of Python, but don’t take the analogy too far. You can use `1` almost anywhere you can use a float, and it will almost always mean the same thing as `1.0` when you do. But that doesn’t mean when you use it in `isinstance(1, float)` it’s the same as `1.0`. So, is `'1'` a valid way of representing the float `1.0`? Yes if you’re doing arithmetic, no if you’re doing type-switching.
Interesting you should say that as I just had an instance of needing to use 0.0 instead of 0 (aka False) to correctly communicate with an ORM back-end that I wanted an integer column with a zero value, not a null. -- ~Ethan~ _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/7GRWAZERS4JEKDMNBQWPHWHJFM6IZSG6/ Code of Conduct: http://python.org/psf/codeofconduct/