> But what if I don't want to add "from ... import *" at the beginning of each
> docstring ?

I had this issue recently.  William informed me that the philosophy of
doctests is that a user should be able to take anything they see in a
doctest and type it directly into sage with no additional commands.
So if your file has to be loaded or imported or whatever in order to
make those commands run then that load/import should be present in the
doctests, that way any user reading those doctests will know that they
need to import your file before they can use it.

If you want to make it so that you don't have to import your file you
can put it somewhere in the sage directory and then add an entry for
it in the all.py file that resides in the same folder as your file.

-Jim

On Tue, Feb 21, 2012 at 8:16 AM, Laurent <moky.m...@gmail.com> wrote:
>
>>>  On 21 Feb., 14:24, Laurent<moky.m...@gmail.com>  wrote:
>>>>
>>>>  Is it normal ? With older versions of sage the same docstring was
>>>> working.
>>>
>>>
>>>  Really? I doubt it.
>
>
>
> Yes, really ;)
> Well, in fact I did not tested THAT example on Sage 4.7, but my usual
> programs had doctrings that were working on 4.7 and that are no more
> working. I just created that example now in order to individuate the problem
> ... could be something else.
>
> So, pragmatically, how can I use doctests with sage ?
> If I add "from sagess import *" as first line of my docstring, then it works
> provided my file is in PYTHONPATH.
>
> But what if I don't want to add "from ... import *" at the beginning of each
> docstring ?
>
> Thanks
> Laurent
>
>
> --
> To post to this group, send email to sage-support@googlegroups.com
> To unsubscribe from this group, send email to
> sage-support+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/sage-support
> URL: http://www.sagemath.org



-- 
Die Dunkelheit... leitet die Musik.
Die Musik... leitet die Seele.

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to