Skip to content

odd behavior when given a initial data #22

@copperfield42

Description

@copperfield42

I just installed anaconda4.3 and I notice this module so I star playing with it and I notice this

>>> from chest import Chest
>>> d={42:23}
>>> c=Chest(d, "my-chest")
>>> list(c)
[]
>>> 42 in c
False 
>>> c[42]
23 
>>> d
{42: 23}
>>> c.flush()
>>> d
{}
>>> list(c)
[]
>>> 42 in c
False
>>> c[42]
Traceback (most recent call last):
  File "<pyshell#11>", line 1, in <module>
    c[42]
  File "C:\Anaconda3\lib\site-packages\chest\core.py", line 182, in __getitem__
    raise KeyError("Key not found: %s" % str(key))
KeyError: 'Key not found: 42'
>>> c.get_from_disk(42)
>>> c[42]
23
>>> 42 in c
False
>>> list(c)
[]
>>> 

why it say that 42 is not in c?
why it empty my initializer?
why I get an empty list when I do list(c)

but if I close python, delete the folder, and start again and don't give it a initial data it work fine

>>> from chest import Chest
>>> c =Chest(path="my-chest")
>>> c[42]=23
>>> 42 in c
True
>>> list(c)
[42]
>>> c.flush()
>>> list(c)
[42]
>>> 42 in c
True
>>> c[42]
23
>>> 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions