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

fix/none_type #27

Merged
merged 1 commit into from
May 29, 2024
Merged

fix/none_type #27

merged 1 commit into from
May 29, 2024

Conversation

JarbasAl
Copy link
Member

closes #26

@JarbasAl JarbasAl added the bug Something isn't working label May 29, 2024
@JarbasAl JarbasAl requested a review from goldyfruit May 29, 2024 16:30
Copy link

@mikejgray mikejgray left a comment

Choose a reason for hiding this comment

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

Why not make the default an empty dict instead of None and then change it later?

@JarbasAl
Copy link
Member Author

Why not make the default an empty dict instead of None and then change it later?

setting a empty dict or list in the method definition is a common mistake in python

Default values in Python are created exactly once, when the function is defined. If that object is changed, subsequent calls to the function will refer to the changed object, ie, context would be kept around across calls

eg

def b(x=[]):
    x.append(5)
    print(x)

>>> b()
[5]
>>> b()
[5, 5]

Copy link

@mikejgray mikejgray left a comment

Choose a reason for hiding this comment

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

Python really needs an immutable dict and list type... :P

Copy link

@mikejgray mikejgray left a comment

Choose a reason for hiding this comment

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

Tests are failing

@JarbasAl
Copy link
Member Author

JarbasAl commented May 29, 2024

Tests are failing

they have been for a while :P unrelated to this PR

we really need to do some cleanup around all skill repos, many have copy pasted automations just to get them published but then have failing tests that just came from somewhere else

@JarbasAl JarbasAl merged commit 9fcae99 into dev May 29, 2024
1 of 9 checks passed
@JarbasAl JarbasAl deleted the fix/none_type branch May 29, 2024 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AttributeError: 'NoneType' object has no attribute 'get'
2 participants