Skip to content

Conversation

@flothjl
Copy link

@flothjl flothjl commented Jan 29, 2023

Similar to the issue discovered in #23 . Make default tag list None and then assign self.tags an empty list if None

demo of bug:

from nostr.event import Event
from nostr.key import PrivateKey

# Create two separate events with default tags value

test_event = Event(
    PrivateKey().public_key.hex(),
    "test content"
)

test_event_2 = Event(
    PrivateKey().public_key.hex(),
    "test content 2"
)

# Append a tag to the first event
test_event.tags.append(["p","p tag"])

print(test_event_2.tags)
#out: [["p","p tag"]]

@flothjl flothjl marked this pull request as ready for review January 29, 2023 19:18
content: str,
created_at: int = None,
kind: int=EventKind.TEXT_NOTE,
tags: "list[list[str]]"=[],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is better done with default_factory see: #84

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants