On Thursday, April 30, 2020 at 9:20:00 AM UTC-7, Michael Orlitzky wrote:On 4/30/20 11:16 AM, Dima Pasechnik wrote:
>
> I think we should just remove this completely, as ipython nowadays has
> %history magic which certainly can do the same as log_text()
>
+1
I feel the same way about functions like search_src() that badly
reimplement grep (even if they still work).They're doctested, and they still work. What makes the implementation bad?
They use standard Python library tools to walk a directory tree and then to do a regexp search on the files there. An advantage to this approach is that it is standard across platforms, as opposed to implementations of grep which differ on linux vs OS X (not to mention Solaris and others).
--
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+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/b62c455f-db74-499a-8b35-b80d24c4cb6e%40googlegroups.com.
On Thu, 30 Apr 2020, 19:10 John H Palmieri, <jhpalm...@gmail.com> wrote:
On Thursday, April 30, 2020 at 9:20:00 AM UTC-7, Michael Orlitzky wrote:On 4/30/20 11:16 AM, Dima Pasechnik wrote:
>
> I think we should just remove this completely, as ipython nowadays has
> %history magic which certainly can do the same as log_text()
>
+1
I feel the same way about functions like search_src() that badly
reimplement grep (even if they still work).They're doctested, and they still work. What makes the implementation bad?what do you mean by "doctested"?yes, they are, they pass all 0 tests that are there :-)
--
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+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/5a14fb7f-4e12-c26c-7cf1-2590cf1e3481%40orlitzky.com.
I agree with David. I use grep 1000 times a day and I do know how to use a computer (and do not appreciate being patronised), but I also use serach_src() in the middle of Sage sessions a lot and tha seems much more useful to me than switching to a different window and navigating to wherever my Sage source code is.
sage: !grep genvecto *
grep: ActiveGSLocalData: Is a directory
grep: Applications: Is a directory
<snip>
I don't know whether python functions can call the ! things but I
think it would help users to keep search_src(s) as a shorthand for
!grep -r s $SAGE_ROOT/src and search_def(s) for search_src("def "+s).
--
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+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/c7dc3bdc-1334-3ec0-da13-e5c91a8b3510%40orlitzky.com.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-...@googlegroups.com.
So before deprecating, consider points of view of users from different backgrounds. We hope that mathematicians are using Sage, and we shouldn't require them to know about "grep". Don't get me wrong, grep is great and I use it all the time, but I bet that many of my colleagues don't know it, don't want to learn the syntax, and would view '!grep -R -n ... "$SAGE_ROOT"/src/sage' as an essentially magical incantation. I think that 'search_src(...)' is more accessible.
On 5/1/20 1:36 PM, John H Palmieri wrote:
>
> So before deprecating, consider points of view of users from different
> backgrounds. We hope that mathematicians are using Sage, and we
> shouldn't require them to know about "grep". Don't get me wrong, grep is
> great and I use it all the time, but I bet that many of my colleagues
> don't know it, don't want to learn the syntax, and would view '!grep -R
> -n ... "$SAGE_ROOT"/src/sage' as an essentially magical incantation. I
> think that 'search_src(...)' is more accessible.
>
This doesn't have to involve an incantations at all. Grep is already
there (and superior) for anyone who wants to use one, but you're free to
open up a GUI file manager, browse to the sage directory,
click a few
things on a drop-down menu, and ask it to search for your string that
way. That's another relatively reusable skill that many people already
know and that solves the same problem on any platform. Grep is really
just a special case of that, "do whatever you would normally do to
search for files containing a string."
I feel the same way about functions like search_src() that badly
reimplement grep (even if they still work).
I feel the same way about functions like search_src() that badly
reimplement grep (even if they still work).I am fine with getting rid of the log_* functions, but I definitively want search_src(), search_def() and search_doc() to stay. Shame on me, but I use them when I need from the sage command line as well as the `sage -grep` instead of grep when I want to search the sage source from *any* directory on my computer.
A script that we ship to end users has to be portable, which is why that
command is a mouthful even though most of that syntax has been in "man
find" forever. But individual users only need something that works on
their machines. So POSIX trivia aside, "do whatever you would normally
do to search a bunch of files for a string" is still the best answer,
On 5/6/20 11:28 PM, John H Palmieri wrote:
>
> And to clarify, this is what you expect users to use instead of
> search_src? ;)
>
On 5/7/20 8:45 AM, kcrisman wrote:
>
> Again, I think it is not necessarily the case that users of
> Sage-the-software - say, in a CoCalc-provided notebook as a student -
> necessarily know how to "search a bunch of files for a string" or even
> know that there is such a thing.
Anyone who wants to search the source code for a string probably knows
that source code and strings both exist, and that one can be searched
for the other. I believe in the user who knows nothing, but I don't
believe that he's interested in search_src() to begin with. (This is the
sort of thing I mean by a peculiar set of disabilities.)
These are both valid concerns. I disagree only in the way we should
address them. Instead of a magic function with a non-standard name that
only kind-of works and that we have to maintain forever, I think these
two cases are better served by some documentation:
... and again many users may not even know there is a directory structure at all. This is not a "highly peculiar set of disabilities" - rather, the skill set of people on sage-devel is a "highly peculiar set of abilities", even among people doing math on a regular basis.
sage: def search_names(string):
....: g = globals()
....: for s in g.keys():
....: if s.find(string)>=0:
....: print(s)
sage: search_names('poly')
bell_polynomial
bernoulli_polynomial
characteristic_polynomial
charpoly
conway_polynomial
cyclotomic_polynomial
exists_conway_polynomial
hilbert_class_polynomial
hyperbolic_polygon
hyperbolic_regular_polygon
lattice_polytope
lfsr_connection_polynomial
minimal_polynomial
minpoly
polygen
polygens
polygon
polygon2d
polygon3d
polygon_spline
polygons3d
polylog
polymake
polytopes
But if we talk about users who are not interested in code and strings, wouldn't it be more useful for them to have a function that searches through the global name space? Do we have such a one?
sage: *poly*?
sage: %psearch *poly*
sage: %psearch -i *poly*
Am Freitag, 8. Mai 2020 09:03:08 UTC+2 schrieb Sebastian Oehms:But if we talk about users who are not interested in code and strings, wouldn't it be more useful for them to have a function that searches through the global name space? Do we have such a one?We do indeed. It is an IPython feature. You can use
sage: *poly*?which is equivalent to
sage: %psearch *poly*The psearch magic also has options such as case-insensitivity
sage: %psearch -i *poly*
On Fri, May 8, 2020 at 10:37 AM Markus Wageringel
<markus.w...@gmail.com> wrote:
>
> Am Freitag, 8. Mai 2020 09:03:08 UTC+2 schrieb Sebastian Oehms:
>>
>> But if we talk about users who are not interested in code and strings, wouldn't it be more useful for them to have a function that searches through the global name space? Do we have such a one?
>
>
> We do indeed. It is an IPython feature. You can use
>
> sage: *poly*?
>
> which is equivalent to
>
> sage: %psearch *poly*
>
> The psearch magic also has options such as case-insensitivity
>
> sage: %psearch -i *poly*
given that iPython features came after search_src(), it'd be prudent
to move to be using them.
sage: %psearch *fundamental_group*
sage: search_def("fundamental_group")
schemes/curves/zariski_vankampen.py:380:def fundamental_group(f, simplified=True, projective=False):
schemes/curves/projective_curve.py:1599: def fundamental_group(self):
schemes/curves/affine_curve.py:1610: def fundamental_group(self):
combinat/root_system/extended_affine_weyl_group.py:757: def fundamental_group(self):
combinat/root_system/extended_affine_weyl_group.py:1387: def to_fundamental_group(self):
combinat/root_system/extended_affine_weyl_group.py:2263: def to_fundamental_group(self):
combinat/root_system/extended_affine_weyl_group.py:2432: def to_fundamental_group(self):
knots/link.py:446: def fundamental_group(self, presentation='wirtinger'):
categories/simplicial_sets.py:262: def fundamental_group(self, simplify=True):
homology/simplicial_complex.py:3936: def fundamental_group(self, base_point=None, simplify=True):
>
>
> As for SageMathCell, I seem to recall that tab completion used to work there as usual, but currently it does not work for me either.
>
> --
> 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-...@googlegroups.com.
I feel the same way about functions like search_src() that badly
reimplement grep (even if they still work).
There are some duplicates in there (I've wasted enough time on it), but
it matches things that a regex never will. That function is implemented
by the following code, which belongs in a third-party library and not
sage itself because it has nothing to do with mathematics: