-
-
Notifications
You must be signed in to change notification settings - Fork 318
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
deterministic memorystore names #2906
Comments
Is the problem there general confusion for users, or something else (like doctests)? For doctests, we can use For general confusion, I guess this did hit me when I was first learning python. But I think there's enough other objects out there that contain a hex memory address that maybe people learn? Not sure. |
I'm not sure if users find this confusing, but I think it's worth asking whether the memory address is a useful property to display for memory store instances. Unlike an s3 bucket or location on the local file system, a memory address for a python object is kind of useless. So I don't think anyone would be inconvenienced if we replaced that repr with something equally useless, but deterministic. |
One key feature of showing the memory address is being able to tell if two memory stores are the same or different. So in that sense yes, showing the memory address is useful. And it seems to me to be the simplest way in terms of implementation of generating a "unique ID" for the store, which statisfies the contstraint that different store instances have different reprs. |
👍 I have relied on this in the past. It's pretty standard to show the address in the default Python repr too. |
to be clear, I'm assuming that memory store instances should have unique names. The question in this issue is whether the memory address of the underlying mutable mapping is a good name, compared to an alternative name that would also be unique, but deterministic. |
iirc memorystore instances get a repr based on the memory location of the underlying dictionary. Any code example that creates a memorystore will generate different output each invocation as the name of the store will change, which is a problem for documentation, as the same example will generate different output. So it would be convenient to give memorystore instances names that are unique but deterministic (within a single python process).
I had 2 ideas:
display_name
kwarg to memorystore creation. The name does nothing except show up in the repr.Does anyone else have ideas here?
The text was updated successfully, but these errors were encountered: