I was thinking of something much deeper, something like:

@optional('eggs')
def spam():
    """
   docstring with the corresponding doctests
    """
    blah


And then, several things happen:


   1. The testing framework ignores the doctests for the function 
   `spam`only if the package `eggs` is installed.
   2. On startup, the function `spam` is defined only if the package `eggs` 
   is installed. In particular, tab completion would only show it if the 
   package is installed.
   3. Documentation for the function is only built if the package is 
   installed.


I know this goes way beyond what you proposed, but on the other hand I 
think it makes sense to distinguish if a package is installed or not at 
more levels than just the doctesting.


El miércoles, 13 de abril de 2016, 19:01:33 (UTC+2), Nicolas M. Thiéry 
escribió:
>
>        Hi Miguel, 
>
> On Wed, Apr 13, 2016 at 03:05:56AM -0700, mmarco wrote: 
> >    Sorry if I sounded rude or disrispectful, It wasn't my intention at 
> >    all. 
>
> No worry, I know :-) 
>
> >    Let me try to redeem myself by proposing some constructive proposal: 
>
> Thanks! 
>
> >    what about a function/method level mark (be it a decorator or a 
> >    comment)? 
>
> The current implementation in #20427 applies only to the current 
> method (in fact only to the doctests after the markup). Up to syntax, 
> is this what you have in mind? Any suggestion of better syntax? 
>
> >    It could have more benefits than just treating correctly the 
> >    doctests.  It could also help, for instance, creating a 
> >    documentation section automatically, or even not exposing the 
> >    function at all if the corresponding package is not installed. 
>
> Yes! Practice would tell us which of those features we would want to 
> implement. 
>
> >    Of course, this idea has many drawbacks: the optional functionality 
> >    might deppend only on certain parameters (e.g. the 'algorithm' 
> >    keyword)... but maybe they could be worked out. 
>
> Indeed; anyway when a finer granularity is required, the usual # 
> optional works just fine. 
>
> Cheers, 
>                                 Nicolas 
>
> [1] http://trac.sagemath.org/ticket/20427 
> -- 
> Nicolas M. Thiéry "Isil" <nth...@users.sf.net <javascript:>> 
> http://Nicolas.Thiery.name/ 
>

-- 
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.

Reply via email to