On Fri, 08 Jun 2012, Johnny MariƩthoz wrote:
> Perhaps a good fix is to check the type of the input parameter and
> generate a comprehensive exception.

Hmm, BibRecDocs's documentation does mention that `recid' should be an
integer, so that's perhaps enough.

Do you meant to check type already in the constructor so as not to
permit the following?

   In [4]: BibRecDocs('10').list_bibdocs()
   Out[4]: [BibDoc(14, '10', 'ep-2001-094', 'Main', False)]
   
   In [5]: BibRecDocs(10).list_bibdocs()
   Out[5]: [BibDoc(14, 10, 'ep-2001-094', 'Main', False)]
   
Or do you mean to accept both str and int in the constructor and amend
only __repr__?

I guess we'd rather forbid the former and take an int out of str 
in case the type transform cleanly.

Best regards
-- 
Tibor Simko

Reply via email to