On Tue, Nov 06, 2012 at 09:36:40PM -0800, Andrew Mathas wrote: > Yes, I am pretty sure that all of the option parsing can be done by > __classcall_private__. Similar things are done in the partition and > tableau tuple code.
+1 > - Would anyone object to making from_* private (i.e. _from_*) since they > are internal helper functions? I do :-) Those are also meant to be called directly by the developer when speed matters. Although arguably one would possibly want: sage: Partitions().from_blah(blah) rather than sage: Partition.from_blah(blah) > Well, this makes it trickier:) An option is one possibility. Speed is a > consideration (Meinolf Geck told me that he didn't use sage for his python > Hecke algebra package because it was too slow...), so perhaps this is not > worth the effort? I think that it is more elegant to use the class, rather > than a function, as the entry point but not if this creates significant > extra overhead... I agree that speed is a consideration. Now, If I recall correctly, Meinholf main speed issue was elsewhere (with the matrix constructor?), and during his talk I had shown how to work around this until the matrix constructor get optimized. > More general question (to everyone), how should we handle the > Partition() factory function (for lack of a better term)? Here's kind of > my questions at present: > - Should we have an optional parent parameter? That should be eventually be handled by the factory infrastructure which fixes conventions on how element class and parent are to be passed down. Maybe you just want to leave things as they are for now until factories come in. > BTW, I am still not convinced by Nicolas' arguments for having optional > classes for changing the sort order. Just for sake of clarity: ``separate parents'' rather than ``optional classes'' > In my GAP code I do this quite often: I have objects indexed by a > fixed set of partitions and I want to be able to change their > default sort order to help me look for patterns. Having to change > the underlying parent class in order to be able to do this seems > a little extreme to me. You don't necessarily need to change the parent of each element (which would indeed be a pain!). You can instead use a facade parent. This could give something like: sage: P = Partitions(3) sage: p = P.list() # create a bunch of elements of P sage: Q = Partitions(3, order=..., facade = True) sage: sorted(p, cmp=Q.cmp) # those are also elements of Q, so we can use the methods from Q Cheers, Nicolas -- Nicolas M. ThiƩry "Isil" <nthi...@users.sf.net> http://Nicolas.Thiery.name/ -- You received this message because you are subscribed to the Google Groups "sage-combinat-devel" group. To post to this group, send email to sage-combinat-devel@googlegroups.com. To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.