[Python-Dev] Re: Python multithreading without the GIL

2021-10-13 Thread Simon Cross
> Still, I hope you at least enjoyed my enthusiasm! I did! ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at

[Python-Dev] What is __int__ still useful for?

2021-10-13 Thread Antoine Pitrou
Hello, It used to be that defining __int__ allowed an object to be accepted as an integer from various functions, internal and third-party, thanks to being implicitly called by e.g. PyLong_AsLong. Today, and since bpo-37999, this is no longer the case. It seems that __int__ has now become a st

[Python-Dev] Heads up: core sprint coming up!

2021-10-13 Thread Łukasz Langa
Hi there, I have a reminder for you if you are: - a core developer; or - on the triage team; or - a mentee in core-mentorship. We are running an online core sprint next week (October 18 - 24). "Online" means on our internal Core Python Discord. Join us there to plan and chat! You can even get a

[Python-Dev] Re: What is __int__ still useful for?

2021-10-13 Thread Serhiy Storchaka
13.10.21 20:10, Antoine Pitrou пише: > It used to be that defining __int__ allowed an object to be accepted as > an integer from various functions, internal and third-party, thanks to > being implicitly called by e.g. PyLong_AsLong. > > Today, and since bpo-37999, this is no longer the case. It s

[Python-Dev] Re: What is __int__ still useful for?

2021-10-13 Thread Greg Ewing
On 14/10/21 6:10 am, Antoine Pitrou wrote: It seems that __int__ has now become a strict equivalent to __trunc__. Not really -- __int__ is expected to return something of type int, whereas __trunc__ is expected to return the same type as its operand. -- Greg ___

[Python-Dev] Re: What is __int__ still useful for?

2021-10-13 Thread Greg Ewing
On 14/10/21 11:19 am, Greg Ewing wrote: Not really -- __int__ is expected to return something of type int, whereas __trunc__ is expected to return the same type as its operand. Scratch that, it seems __trunc__ also returns an int, at least for floats. Not sure what the logic behind that is. Th

[Python-Dev] Re: What is __int__ still useful for?

2021-10-13 Thread Victor Stinner
Hi Antoine, I have a lot of troubles to reminder how Python converts numbers, I collected notes about the Python "number tower" and the C implementation: https://pythondev.readthedocs.io/numbers.html Honestly, I don't understand well the difference between __int__() and __index__(). * https://do

[Python-Dev] Re: What is __int__ still useful for?

2021-10-13 Thread Chris Angelico
On Thu, Oct 14, 2021 at 10:51 AM Victor Stinner wrote: > > Honestly, I don't understand well the difference between __int__() and > __index__(). > > * https://docs.python.org/dev/reference/datamodel.html#object.__int__ > * https://docs.python.org/dev/reference/datamodel.html#object.__index__ __in

[Python-Dev] Re: What is __int__ still useful for?

2021-10-13 Thread Guido van Rossum
On Wed, Oct 13, 2021 at 4:56 PM Victor Stinner wrote: > Honestly, I don't understand well the difference between __int__() and > __index__(). > > * https://docs.python.org/dev/reference/datamodel.html#object.__int__ > * https://docs.python.org/dev/reference/datamodel.html#object.__index__ > If y

[Python-Dev] Re: What is __int__ still useful for?

2021-10-13 Thread Antoine Pitrou
On Thu, 14 Oct 2021 11:52:11 +1300 Greg Ewing wrote: > On 14/10/21 11:19 am, Greg Ewing wrote: > > Not really -- __int__ is expected to return something of type > > int, whereas __trunc__ is expected to return the same type as > > its operand. > > Scratch that, it seems __trunc__ also returns

[Python-Dev] Re: What is __int__ still useful for?

2021-10-13 Thread Steven D'Aprano
On Thu, Oct 14, 2021 at 11:52:11AM +1300, Greg Ewing wrote: > Scratch that, it seems __trunc__ also returns an int, at least > for floats. Not sure what the logic behind that is. I'm not sure about the logic either, but it is documented as returning an Integral: "Truncates the Real x to the nea