shared-memory-dict icon indicating copy to clipboard operation
shared-memory-dict copied to clipboard

Allow SharedMemoryDict to be initialized like a regular dictionary

Open cassiobotaro opened this issue 2 years ago • 1 comments

There is an PR suggesting the addition of *args and **kwargs in our object initialization, but I would like to discuss some points and maybe a possible postponement of this implementation to release a major version, since it can change the method signature.

Some ideas and considerations:

  • Adding args and kwargs along with dictionary initialization will throw an error about creating a dictionary, wouldn't it be better for a specific non-dictionary exception?
  • Today "name" is a positional or named parameter and it is mandatory. But when initializing shared memory it is not.
  • Maybe we should remove serializer from __init__ and use it from serializer module, like logging module.
  • ShareableList uses the size from the iterator param. Why not do the same, but optionally allow to define a size?
  • We should consider putting name and size as mandatory named parameters. This will imply that both cannot be used as a key. Removing the serializer from __init__ also helps here, considering it will be one less name.

I would like to listen to your opinions @spaceone, @renanivo, @jeanmask, @itheodoro, @thyagomininelli.

cassiobotaro avatar Nov 06 '21 13:11 cassiobotaro