Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

__complex__/__int__/__float__/__round__ #17

Closed
flying-sheep opened this issue Jun 27, 2016 · 6 comments
Closed

__complex__/__int__/__float__/__round__ #17

flying-sheep opened this issue Jun 27, 2016 · 6 comments

Comments

@flying-sheep
Copy link

can we do those?

@flying-sheep
Copy link
Author

no we can’t 😢

TypeError: __int__ returned non-int (type function)

@jacobbridges
Copy link

Could you provide a use case?

@flying-sheep
Copy link
Author

a currently open notebook:

sorted(acc, key=lambda a: int(a[3:]))

should be

sorted(acc, key=int(_[3:]))

@jacobbridges
Copy link

Ah, I see. We could investigate adding it as a feature.

@Digenis
Copy link
Member

Digenis commented Jun 27, 2016

Called to implement the built-in functions complex(), int(), float() and round().
Should return a value of the appropriate type.

This similar to kachayev#65
I already explain there.
We can't do this with all magic methods.

I think we should add to the documentation a sentence
saying that _ requires good knowledge of the python data model

@jacobbridges
Copy link

Thanks @Digenis for the insight. I will read through the python data model again and refresh my memory before updating the documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants