You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The end developer would not know, that the above function can only be called, after Lucia has been initialized.
I propose to make common error conditions into annotations like the following (due note, that the name can be changed)
@lucia.conditions.should_be_initialized def show_window(*args): # logic here
And the code for the annotation would look something like this.
def should_be_initialized(func): def __inner__(*args, **kwargs): if initialized == False: # pseudocode to check if lucia has been initialized, if not raise lucia.exceptions.LuciaNotInitializedError raise lucia.exceptions.LuciaNotInitializedError return func return __inner__
The reason for making the conditions annotations, is so people will be able to use them in their own code like the following.
``
import lucia.conditions
@lucia.conditions.should_be_initialized
def game_function(*args):
# this function can only be executed after lucia has been initialized.
``
What do people thing.
The text was updated successfully, but these errors were encountered:
Lucia should throw exceptions where appropriate.
Take into account, the following example:
def show_window(*args): # logic here
The end developer would not know, that the above function can only be called, after Lucia has been initialized.
I propose to make common error conditions into annotations like the following (due note, that the name can be changed)
@lucia.conditions.should_be_initialized def show_window(*args): # logic here
And the code for the annotation would look something like this.
def should_be_initialized(func): def __inner__(*args, **kwargs): if initialized == False: # pseudocode to check if lucia has been initialized, if not raise lucia.exceptions.LuciaNotInitializedError raise lucia.exceptions.LuciaNotInitializedError return func return __inner__
The reason for making the conditions annotations, is so people will be able to use them in their own code like the following.
``
import lucia.conditions
@lucia.conditions.should_be_initialized
def game_function(*args):
# this function can only be executed after lucia has been initialized.
``
What do people thing.
The text was updated successfully, but these errors were encountered: