This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steven.daprano
Recipients Alessandro Cucci, cheryl.sabella, steven.daprano
Date 2019-05-24.16:35:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1558715756.94.0.557849233099.issue36461@roundup.psfhosted.org>
In-reply-to
Content
Michele, Alessandro, thank you both for your work! And thank you Cheryl for managing this ticket.

I like mangrisano's design where the target time is passed as an argument to the ``autorange`` method, although I prefer the name "target_time". (But I'm open to alternatives.)

So I think a good approach might be a hybrid between mangrisano's design, and the design by Alessandro:

1. the constructor takes the target time and records it as an attribute;

def __init__(self, ..., target_time=default_target_time):
    self.target_time = target_time


2. when the ``timeit`` method is used, if number=0 the target time is taken from self.target_time and passed to ``autorange``;

- if the ``autorange`` method is called directly, the caller can override the target time by passing it as argument; otherwise the default value is looked up from the instance attribute.

So something like

def autorange(self, callback=None, target_time=None):
    if target_time is None:
        target_time = self.target_time
    ...


Please suggest alternatives or point out anything I may have missed, and thank you all again!

(I'm now going to be away from the keyboard for at least the next 18 hours so if I don't reply quickly, that's why.)
History
Date User Action Args
2019-05-24 16:35:56steven.dapranosetrecipients: + steven.daprano, cheryl.sabella, Alessandro Cucci
2019-05-24 16:35:56steven.dapranosetmessageid: <1558715756.94.0.557849233099.issue36461@roundup.psfhosted.org>
2019-05-24 16:35:56steven.dapranolinkissue36461 messages
2019-05-24 16:35:56steven.dapranocreate