Skip to content

Parse as float, then cast to int#5019

Closed
bjester wants to merge 1 commit intolearningequality:hotfixesfrom
bjester:int-float-string
Closed

Parse as float, then cast to int#5019
bjester wants to merge 1 commit intolearningequality:hotfixesfrom
bjester:int-float-string

Conversation

@bjester
Copy link
Copy Markdown
Member

@bjester bjester commented Apr 24, 2025

Summary

In python:

  • if x = 25.5, then int(x) == 25
  • if x = '25.5', then int(x) throws an exception
  • if x = '25.5', then float(x) == 25.5 and thus int(float(x)) == 25 works for both strings, floats, and ints

References

#4990 (comment)

@bjester
Copy link
Copy Markdown
Member Author

bjester commented Apr 24, 2025

Talking with @rtibbles, we don't want to do this. We'll implement a different approach

@bjester bjester closed this Apr 24, 2025
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.

1 participant