Skip to content
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

remove default tags list from Event class. #44

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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
@@ -23,7 +23,7 @@ def __init__(
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