Usually the "huge source file" problem is just a symptom of trying to stuff everything into one class. You should probably think about whether you can introduce a class hierarchy somewhere, especially if your is_something() property doesn't make sense for the most generic graph. Maybe you want to put your code into a PerfectGraph subclass, for example.
On Monday, June 18, 2012 11:34:15 AM UTC+1, Nathann Cohen wrote: > > Helloooooooooo everybody !!! > > Our graph files are getting quite large, and there is in some situations a > way to make it shorter : we can define some functions in modules and import > them in the Graph class afterwards. For instance in #13073 we do > > class Graph: > ... > ... > is_weakly_chordal = sage.graphs.weakly_chordal.is_weakly_chordal > > This works well because is_weakly_chordal is defined like that : > > def is_weakly_chordal(g): > > Hence when G.is_weakly_chordal is called, "self" becomes "g" and > everything goes well. > > This, however, does not see to be possible with Cython files (if > graphs/weakly_chordal.py was graphs/weakly_chordal.pyx) and I get the > following : > > TypeError: is_weakly_chordal() takes exactly one argument (0 given) > > It looks like in this case the "self" is not given as an argument to the > function where it expects "g", and so..... it fails :-) > > Would anybody know a way around ? > > What we have been doing is create "fake" functions in Graph that just wrap > others from their module, but each time we need to duplicate documentation > and tests, maintain it, and it is just bad coding anyway... :-) > > Thaaaaaaaaaaaaaaaaaaaaaaaaaaaaanks !! > > Nathann > > -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org