#11935: Make parent/element classes independent of base rings
-----------------------------------------------------------------+----------
       Reporter:  SimonKing                                      |         
Owner:              
           Type:  enhancement                                    |        
Status:  needs_review
       Priority:  major                                          |     
Milestone:  sage-5.0    
      Component:  categories                                     |    
Resolution:              
       Keywords:  parent class, element class, category          |   Work 
issues:              
Report Upstream:  N/A                                            |     
Reviewers:              
        Authors:  Simon King                                     |     Merged 
in:              
   Dependencies:  #9138, #11900, #11943, #12875, #12876, #12877  |      
Stopgaps:              
-----------------------------------------------------------------+----------

Comment (by nthiery):

 Replying to [comment:63 SimonKing]:
 > That seems suboptimal to me:
 > ...
 > test1 is as in your code: inspect is imported, and (at least it seems to
 me) the error message is created even if the error does not occur. test2
 does not import inspect again, while test3 is an attempt to not create the
 error message.
 >
 > To my surprise, creating the error message seems to be essentially for
 free. But one should really import inspect top-level, I think.

 According to: http://docs.python.org/reference/simple_stmts.html
 {{{
 assert expression1, expression2
 }}}
 is equivalent to:
 {{{
 if __debug__:
    if not expression1: raise AssertionError(expression2)
 }}}

 This means in particular that expression2 is *not* evaluated if
 expression1 does not hold. So we don't need to worry about efficiency
 in those.

 That being said, yes, the ``import inspect'' should be at the
 toplevel! Thanks for catching this.

 Are you in the process of writing a reviewer's patch, or do you want
 me to do the change? Note: I am flying to Montreal tomorrow, and my
 wife arrives in one hour from a two weeks mission; so you probably
 won't hear much from me until Sunday.

 Cheers,
                          Nicolas

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11935#comment:72>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to