On Wednesday, October 12, 2016 at 9:01:51 AM UTC-5, Daniel Krenn wrote:
> On 2016-10-12 13:39, Jori Mäntysalo wrote:
> > More about this: In posets.py there is
> > try:
> > elements = D.topological_sort()
> > except Exception:
> > raise ValueError("Hasse diagram contains cycles.")
> > and that should be "except TypeError", as that is what
> > .topological_sort() raises from DiGraph that is not acyclic.
> > But should a function without parameters like foo.bar() ever raise
> > TypeError? If we can run that, then the object foo is of the right type
> > and has bar()-function. Or where goes the limit between TypeError and
> > ValueError, i.e. what we mean by 'type' -- is DAG a "type" or just a
> > DiGraph with some special properties?
> There could be a ContainsCycleError which has RuntimeError as a base...
IMO a ValueError is better than a TypeError because topological_sort
(implicitly) takes the DiGraph as an input, and the input type is correct,
just its value is wrong. Although this is more towards bikeshedding...
You received this message because you are subscribed to the Google Groups
To unsubscribe from this group and stop receiving emails from it, send an email
To post to this group, send email to firstname.lastname@example.org.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.