#6097: [with patch, needs review] Implements a mantra for declaring abstract
methods
-------------------------+--------------------------------------------------
 Reporter:  nthiery      |       Owner:  nthiery         
     Type:  enhancement  |      Status:  assigned        
 Priority:  major        |   Milestone:  sage-4.0.2      
Component:  misc         |    Keywords:  abstract methods
 Reviewer:               |      Author:  nthiery         
   Merged:               |  
-------------------------+--------------------------------------------------

Comment(by nthiery):

 Replying to [comment:13 ncalexan]:
 > Replying to [comment:12 nthiery]:
 > > Replying to [comment:11 ncalexan]:
 > > > >  - Instantiating an instance of an abstract class (which should
 not be permitted in the first place)
 > > >
 > > > Why not make __init__ (or __new__) raise NotImplementedError?
 > >
 > > Because abstract methods are perfectly valid in an abstract class.
 Actually, the user will want to use introspection to query for their doc,
 ...
 >
 > This seems wrong to me.  __init__ is only called on instance creation.
 Raising NotImplementedError in instance creation just means you can't
 create an instance.  How does this have anything to do with abstract
 methods or introspection?

 Oh, sorry, I got completely confused. I though you were speaking about the
 __init__ of the AbstractMethod class.

 Yes, adding an __init__ or __new__ to abstract classes, so as to prevent
 element creation would sound reasonable.
 And we typically would want to do this by having and @abstract_class
 decorator. To be kept in mind for the future.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/6097#comment:14>
Sage <http://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