Re: [Rdkit-devel] Python vs C++ exceptions
Open-Source Cheminformatics and Machine Learning
Brought to you by:
glandrum
|
From: Greg L. <gre...@gm...> - 2010-12-13 19:26:59
|
On Mon, Dec 13, 2010 at 7:09 PM, gi...@gm... <gi...@gm...> wrote:
> On Mon, Dec 13, 2010 at 5:14 PM, Greg Landrum <gre...@gm...> wrote:
>> #--------
>>
>> supplier = Chem.SDMolSupplier('foo.sdf')
>> for mol in supplier:
>> if mol is None: continue
>> #otherwise do whatever you need to do with the molecule.
>
> Thanks, that's what I ended up doing.
>
> If you think it's technically doable and see value in explicitly
> forwarding the exception, I could report this in the tracker,
> otherwise, let's move on :-)
I think having the molecule construction functions return None instead
of throwing exceptions is a useful feature: it really simplifies
writing client code to not have to worry about catching exceptions
every time you try and build a molecule. There would, on the other
hand, be some value in being able to more easily programmatically
determine where an error occurred while processing a molecule. This is
probably doable and is certainly worth thinking about.
-greg
|