Skip to content

deleting attribute or item does not remove attribute #24

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
orlof opened this issue Feb 17, 2023 · 1 comment · May be fixed by #38
Open

deleting attribute or item does not remove attribute #24

orlof opened this issue Feb 17, 2023 · 1 comment · May be fixed by #38
Labels
bug Something isn't working

Comments

@orlof
Copy link

orlof commented Feb 17, 2023

Version

0.4.0

Python

Python 3.9.16

Description

I ran this code:

from dotwiz import DotWiz

d = DotWiz()
d.a = 1
del d.a
print(d.a)

I expected to see this happen: AttributeError: 'DotWiz' object has no attribute 'b'

Instead, this happened: 1

Context

I am not sure if assignments or deletes are even supported as the docs only show creation and access examples.

@orlof orlof added the bug Something isn't working label Feb 17, 2023
@timotheecour
Copy link

timotheecour commented Feb 9, 2024

seems like the most serious bug in this library, which should be prioritized before more widespread use

looks like it semi-deletes the key for some methods (keys, values, print) but not others (direct access via d['a'] or d.a):

    from dotwiz import DotWiz
    d = DotWiz()
    d.a = 1
    d.a2 = 2
    print(d)
    print(d.keys(), d.values())
    del d.a
    print(d)
    print(d.a)
    print(d['a'])
    print(dir(d))
    print(d.keys(), d.values())
✫(a=1, a2=2)
dict_keys(['a', 'a2']) dict_values([1, 2])
✫(a2=2)
1
1
['__class__', '__class_getitem__', '__contains__', '__delattr__', '__delitem__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__ior__', '__iter__', '__le__', '__len__', '__lt__', '__module__', '__ne__', '__new__', '__or__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__ror__', '__setattr__', '__setitem__', '__sizeof__', '__slots__', '__str__', '__subclasshook__', 'a', 'a2', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'to_dict', 'update', 'values']
dict_keys(['a2']) dict_values([2])

timotheecour added a commit to timotheecour/dotwiz that referenced this issue Feb 9, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants