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

Sinplified func(self) #309

Merged
merged 2 commits into from
Nov 13, 2023
Merged

Sinplified func(self) #309

merged 2 commits into from
Nov 13, 2023

Conversation

Nex-Pro
Copy link
Contributor

@Nex-Pro Nex-Pro commented Oct 31, 2022

simplified code using ternary ( not tested )

@hlorus
Copy link
Owner

hlorus commented Nov 1, 2022

Thanks for the patch, i agree the snippet of code could be imporved. However putting everything on one line doesn't make it more readable IMO. I would suggest to simply remove the else as it's not needed.

@@ -20,11 +20,7 @@ def slvs_entity_pointer(cls, name, **kwargs):
@property
def func(self):
index = getattr(self, index_prop)
if index == -1:
return None
else:
Copy link
Owner

Choose a reason for hiding this comment

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

Simply removing this line and unindenting the else block improves readability alot.

else:
return bpy.context.scene.sketcher.entities.get(index)

return none if index == -1 else bpy.context.scene.sketcher.entities.get(index)
Copy link
Collaborator

Choose a reason for hiding this comment

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

*None :)

@hlorus hlorus merged commit a7c2d0a into hlorus:main Nov 13, 2023
1 check failed
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.

None yet

3 participants