[Python-Dev] Re: Memory address vs serial number in reprs

2020-07-19 Thread Carl Shapiro
On Sun, Jul 19, 2020 at 1:34 PM Thomas Moreau wrote: > While it would be nice to have simpler identifiers for objects, it would > be hard to make it work for multiprocessing, as objects in different > interpreter would end up having the same repr. Shared objects (locks) might > also have

[Python-Dev] Re: PEP 622 aspects

2020-07-19 Thread Koos Zevenhoven
On Sun, Jul 19, 2020 at 3:00 PM Tobias Kohn wrote: > Quoting Koos Zevenhoven : > > > (1) Class pattern that does isinstance and nothing else. > > > > If I understand the proposed semantics correctly, `Class()` is > equivalent to checking `isinstance(obj, Class)`, also when `__match_args__` > is

[Python-Dev] Re: Memory address vs serial number in reprs

2020-07-19 Thread Richard Damon
On 7/19/20 4:30 PM, Thomas Moreau wrote: > Dear all, > > While it would be nice to have simpler identifiers for objects, it > would be hard to make it work for multiprocessing, as objects in > different interpreter would end up having the same repr. Shared > objects (locks) might also have

[Python-Dev] Re: Memory address vs serial number in reprs

2020-07-19 Thread Thomas Moreau
Dear all, While it would be nice to have simpler identifiers for objects, it would be hard to make it work for multiprocessing, as objects in different interpreter would end up having the same repr. Shared objects (locks) might also have different serial numbers depending on how many objects have

[Python-Dev] Re: Memory address vs serial number in reprs

2020-07-19 Thread Antoine Pitrou
On Sun, 19 Jul 2020 18:38:30 +0300 Serhiy Storchaka wrote: > I have problem with the location of hexadecimal memory address in custom > reprs. > > > > vs > > How about putting it in parentheses, to point more clearly that it can most of the time be ignored: > I do not

[Python-Dev] Re: Memory address vs serial number in reprs

2020-07-19 Thread Guido van Rossum
That looks expensive, esp. for objects implemented in Python — an extra dict entry plus a new unique int object. What is the problem you are trying to solve for these objects specifically? Just that the hex numbers look distracting doesn’t strike me as sufficient motivation. On Sun, Jul 19, 2020

[Python-Dev] Re: Memory address vs serial number in reprs

2020-07-19 Thread Steven D'Aprano
On Sun, Jul 19, 2020 at 06:38:30PM +0300, Serhiy Storchaka wrote: > What if use serial numbers to differentiate instances? I like this idea. It is similar to how Jython and IronPython object IDs work: # Jython >>> id(None) 2 >>> id(len) 3 >>> object() > I do not

[Python-Dev] Memory address vs serial number in reprs

2020-07-19 Thread Serhiy Storchaka
I have problem with the location of hexadecimal memory address in custom reprs. vs The long hexadecimal number makes the repr longer and distracts attention from other useful information. We could get rid of it, but it is useful if we want to distinguish objects of the same type.

[Python-Dev] Re: PEP 622: Structural Pattern Matching -- followup

2020-07-19 Thread Rob Cliffe via Python-Dev
On 08/07/2020 16:15, MRAB wrote: On 2020-07-08 03:08, Rob Cliffe via Python-Dev wrote: Why not use '=' to distinguish binding from equality testing:       case Point(x, =y): # matches a Point() with 2nd parameter equal to y; if it does, binds to x. This would allow a future (or present!)

[Python-Dev] Re: Another take on PEP 622

2020-07-19 Thread Tobias Kohn
Hi Terry, Thank you: I really like your wave/particules analogy.  I think that pattern matching is indeed uniting different concepts to build a stronger, more versatile structure. I also like your concept of a general "binding structure" with different forms, such as assignment,

[Python-Dev] Re: PEP 622 aspects

2020-07-19 Thread Tobias Kohn
Hi Koos, Let me try and address some of the concerns and questions you are rising.  I am replying here to two emails of yours so as to keep traffic down. Quoting Koos Zevenhoven : > (1) Class pattern that does isinstance and nothing else. If I understand the proposed semantics