> Why are you proposing local imports? If python puts a performance penalty > on them (in fact a significant performance penalty), they should be > avoided, no? > > It is a relatively small penalty, so when it is not in a tight loop, it is useful to break out of those cyclic imports (and has better locality of reference).
> It's not that I'm doing these optimizations just for fun. I am applying > many of these little maps very very very often. I am now optimizing those > which I can and which are among the top offenders. Without this, my > program will simply not finish in any reasonable time on my computer. > > In this case, it is a natural tight loop local and should not be there. As I mentioned on the ticket, I think a way forward would be to do a check for a _matrix_ attribute (which we might need to add to those classes). However, there is something to be said about the *order* of the testing, in that checking for lists/tuples is probably be more likely to happen and should be higher on the checking order, which would probably make any issues about local imports for you moot. Best, Travis -- 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 https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.