[Tutor] help with a class
ramit.prasad at jpmorgan.com
Wed Aug 24 22:03:15 CEST 2011
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):
""" completely overide the options dict """
if not isinstance(options, dict):
raise TypeError("override options requires a dict")
if run_id in self.run_queue:
self.run_queue[run_id] = options
self.options = options
Do you really care if it is a dict versus defaultdict or something else that is dict-like? This will fail if I pass in a dict-like class (i.e. if I wrote dict from scratch) that does not inherit from dict.
Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423
This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.
More information about the Tutor