Just define your own exception

class LatticeMeetException(ValueError):
    def __init__(self, msg, x, y):
        ...

The HasseDiagram.meet_matrix already raises if there is no bottom, no need 
to check that again at every step.



On Thursday, November 12, 2015 at 5:48:51 AM UTC-8, Jori Mäntysalo wrote:
>
> Problem: 
>
> LatticePoset({'a':['b', 'c'], 'b':['d', 'e'], 'c':['d', 'e'], 
> 'd':['f'], 'e':['f']}) 
>
> returns "ValueError: Not a lattice." I would like to see for example "Not 
> a lattice: no meet for e and d." 
>
> Solution: From hasse_diagram.py do not raise just "no meet for x=1 y=2" 
> but exception with value more complicated than a string. 
>
> Question: Will this break something? I.e. can "internal" classes raise 
> these kind of exceptions? 
>
> Example implementation: http://trac.sagemath.org/ticket/19163 . NOT in 
> needs_review yet. 
>
> -- 
> Jori Mäntysalo 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to