John wrote:
Thanks for the feedback. I wasn't aware about the assert usage not
being intended for production code.
That's not quite true. There is nothing wrong with using asserts in
production code. The important thing is to use them *properly*. Asserts
are for checking your internal program
Thanks for the feedback. I wasn't aware about the assert usage not
being intended for production code.
On Wed, Aug 24, 2011 at 11:37 PM, Alan Gauld wrote:
> On 24/08/11 21:03, Prasad, Ramit wrote:
>>
>> I was under the impression that asserts are more for testing
>
>> than for production code
>
>
On 24/08/11 21:03, Prasad, Ramit wrote:
I was under the impression that asserts are more for testing
> than for production code
That's true.
def overide_options(self, options, run_id=None):
if not isinstance(options, dict):
raise TypeError("override options requires
I was under the impression that asserts are more for testing than for
production code (especially since they can be removed when running from python
from command line). Instead I removed the assert and replaced it to raise an
error.
def overide_options(self, options, run_id=None):
"""
Thank you. I've corrected the KeyError, and changed the function to:
def overide_options(self, options, run_id=None):
""" completely overide the options dict """
assert isinstance(options, dict), "override options requires a dict"
if run_id in self.run_queue:
On Wed, Aug 24, 2011 at 8:34 PM, John wrote:
> Hello, I have a class that has an attribute that is a dict which I
> fill with more dicts. I've created a function to return those
> dictionaries if a key is provide, otherwise, it returns the 'default'
> dictionary.
>
> I have the following methods (
Hello, I have a class that has an attribute that is a dict which I
fill with more dicts. I've created a function to return those
dictionaries if a key is provide, otherwise, it returns the 'default'
dictionary.
I have the following methods (see below), it seems the update_options
method is fine, b