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

Instantiate and start timer on single line #52

Open
Evidlo opened this issue Feb 21, 2024 · 0 comments
Open

Instantiate and start timer on single line #52

Evidlo opened this issue Feb 21, 2024 · 0 comments

Comments

@Evidlo
Copy link

Evidlo commented Feb 21, 2024

It would be helpful if there was a way to start the timer when it is instantiated, such as t = Timer().start() or t = Timer(now=True).

This can reduce the number of required lines from 3 to 2 which is nice when inserting many timers.

t = Timer().start()
# code block 1
t.stop()

t = Timer().start()
# code block 2
t.stop()

t = Timer().start()
# code block 3
t.stop()

To do this, either .start() would need to return self or a Timer.__post_init__ function would need to if self.now == True.

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

No branches or pull requests

1 participant