Re: [COOT] python or scheme?
Markus Dehnhardt wrote: > Dear cooters, > > I am new to coot, but I have already discovered how powerful > extensions and key bindings can be. My question is quite simple: if > I want to generate my own extension or keybinding, which scripting > language is better suited? I am not very familiar with either but > willing to experiment. > > There were similar questions already on this mailing list but there > are a couple of things that are not clear to me: > > Some of the documentation is for python some for scheme: "the > scripting interface" is python and the "reference manual" is > scheme. Are all functions awailable for both? Or does one have any > advantage over the other? Sigh... Well, you are not the first person to be confused by this. The state of the scripting documentation has been reported as problematic for a while. I don't know what do to about it that does not involved a lot of work. Yes, the User Manual is mostly written with schemey examples. The reference manual I have not looked at for years :-/, the scripting interface page is also automatically generated and provides an interface from a C-programmers point of view - which is very like that for Python. I use often this quite often. The "scripting interface for functions written in scheme/python" should equivalent access to functions that do the same thing. The syntax of the function calls can be readily converted between scheme and python. There are notes available on how to do this. The functions that we saw today, for example, could have equally well have been written in python. > What is other users preference: python or scheme, and why? For those who are not influenced by me, python I'd say. And they chose python because it is more readily picked up for those with an imperative or object-oriented mind-set. Like the dolphins, I'd choose scheme for exactly the same reasons. > How often do people, other than developers, create extensions? Hard to say, but my feeling is "not often enough". And that is, I suppose, is due to the poor state of the scripting/extension documentation. That and the fact that it takes an investment of time to learn the scripting language, the Coot extensions API and the GUI toolkit. > And finally to the scheme scripters: how did you learn scheme? The Little Schemer and Ken Dybvig's "The Scheme Programming Language". To answer your question: python or scheme? Yes! We provide the best 2 languages so that you have the choice. How to choose? Read "The Little Schemer" - if you think it is delightful and stimulating, use sheme. If you think it is hateful, irrelevant and full of irritating silly parentheses, use python. HTH, Paul.
Re: [COOT] python or scheme?
I'm totally not with Paul on this one (is scheme object-oriented???), and eternally grateful to him and Bernhard for implementing python scripting. Once you understand how python fits, it's spectacularly powerful. If you want a list of all commands available in the python interpreter -- some native python, some from the scripting -- you can run the following in the python script window: import inspect; inspect.currentframe().f_globals.keys() It doesn't tell you what the functions do or the arguments are (it's possible in theory, haven't figured it out yet though), but it's a start. phx. Paul Emsley wrote: Markus Dehnhardt wrote: > Dear cooters, > > I am new to coot, but I have already discovered how powerful > extensions and key bindings can be. My question is quite simple: if > I want to generate my own extension or keybinding, which scripting > language is better suited? I am not very familiar with either but > willing to experiment. > > There were similar questions already on this mailing list but there > are a couple of things that are not clear to me: > > Some of the documentation is for python some for scheme: "the > scripting interface" is python and the "reference manual" is > scheme. Are all functions awailable for both? Or does one have any > advantage over the other? Sigh... Well, you are not the first person to be confused by this. The state of the scripting documentation has been reported as problematic for a while. I don't know what do to about it that does not involved a lot of work. Yes, the User Manual is mostly written with schemey examples. The reference manual I have not looked at for years :-/, the scripting interface page is also automatically generated and provides an interface from a C-programmers point of view - which is very like that for Python. I use often this quite often. The "scripting interface for functions written in scheme/python" should equivalent access to functions that do the same thing. The syntax of the function calls can be readily converted between scheme and python. There are notes available on how to do this. The functions that we saw today, for example, could have equally well have been written in python. > What is other users preference: python or scheme, and why? For those who are not influenced by me, python I'd say. And they chose python because it is more readily picked up for those with an imperative or object-oriented mind-set. Like the dolphins, I'd choose scheme for exactly the same reasons. > How often do people, other than developers, create extensions? Hard to say, but my feeling is "not often enough". And that is, I suppose, is due to the poor state of the scripting/extension documentation. That and the fact that it takes an investment of time to learn the scripting language, the Coot extensions API and the GUI toolkit. > And finally to the scheme scripters: how did you learn scheme? The Little Schemer and Ken Dybvig's "The Scheme Programming Language". To answer your question: python or scheme? Yes! We provide the best 2 languages so that you have the choice. How to choose? Read "The Little Schemer" - if you think it is delightful and stimulating, use sheme. If you think it is hateful, irrelevant and full of irritating silly parentheses, use python. HTH, Paul.
Re: [COOT] python or scheme?
my nomination for "Most Useful Improvement to the Reference Manual" would be a verbosity setting that emitted traces to the console window on invocation of each function for which a scriptable wrapper existed (basically being able to follow all interpreter to implementation transitions). Currently the console output is quite helpful, but could be more so. thanks, Alastair Paul Emsley wrote: Markus Dehnhardt wrote: > Dear cooters, > > I am new to coot, but I have already discovered how powerful > extensions and key bindings can be. My question is quite simple: if > I want to generate my own extension or keybinding, which scripting > language is better suited? I am not very familiar with either but > willing to experiment. > > There were similar questions already on this mailing list but there > are a couple of things that are not clear to me: > > Some of the documentation is for python some for scheme: "the > scripting interface" is python and the "reference manual" is > scheme. Are all functions awailable for both? Or does one have any > advantage over the other? Sigh... Well, you are not the first person to be confused by this. The state of the scripting documentation has been reported as problematic for a while. I don't know what do to about it that does not involved a lot of work. Yes, the User Manual is mostly written with schemey examples. The reference manual I have not looked at for years :-/, the scripting interface page is also automatically generated and provides an interface from a C-programmers point of view - which is very like that for Python. I use often this quite often. The "scripting interface for functions written in scheme/python" should equivalent access to functions that do the same thing. The syntax of the function calls can be readily converted between scheme and python. There are notes available on how to do this. The functions that we saw today, for example, could have equally well have been written in python. > What is other users preference: python or scheme, and why? For those who are not influenced by me, python I'd say. And they chose python because it is more readily picked up for those with an imperative or object-oriented mind-set. Like the dolphins, I'd choose scheme for exactly the same reasons. > How often do people, other than developers, create extensions? Hard to say, but my feeling is "not often enough". And that is, I suppose, is due to the poor state of the scripting/extension documentation. That and the fact that it takes an investment of time to learn the scripting language, the Coot extensions API and the GUI toolkit. > And finally to the scheme scripters: how did you learn scheme? The Little Schemer and Ken Dybvig's "The Scheme Programming Language". To answer your question: python or scheme? Yes! We provide the best 2 languages so that you have the choice. How to choose? Read "The Little Schemer" - if you think it is delightful and stimulating, use sheme. If you think it is hateful, irrelevant and full of irritating silly parentheses, use python. HTH, Paul.
Re: [COOT] python or scheme?
2009/2/25 Frank von Delft : > I'm totally not with Paul on this one (is scheme object-oriented???), and > eternally grateful to him and Bernhard for implementing python scripting. I think that the point was that scheme is not imperative and not particularly object-oriented (but allows both). > Once you understand how python fits, it's spectacularly powerful. > If you want a list of all commands available in the python interpreter -- > some native python, some from the scripting -- you can run the following in > the python script window: > import inspect; inspect.currentframe().f_globals.keys() > It doesn't tell you what the functions do or the arguments are (it's > possible in theory, haven't figured it out yet though), but it's a start. > You can do that in scheme too (in the scheme scripting window): (apropos-internal "") It will be a rather long list, but it will give you a hint what to google for. Another couple of hints: - there is no command completion in the scheme scripting window, there is in python - wincoot doesn't do scheme, but does python. - you can't do all gtk2 things from scheme (as coot doesn't come with guile-gnome), there's no such limitation in python. Hopefully one day there will be no such differences...? But I feel that these shouldn't put anyone off. Scheme is still fun and well worth picking up. J.
Re: [COOT] python or scheme?
Some of these things are not difficult, they just need a little time and the ideas. I wonder if we need a 'Coot Janitors' project, modelled on the Linux 'kernel janitors', which helps people get involved in doing some of the easier jobs that needs to be done. If we were to start writing 'how to contribute to coot' documentation, how many people would be interested in actually doing it? Kevin Alastair Fyfe wrote: my nomination for "Most Useful Improvement to the Reference Manual" would be a verbosity setting that emitted traces to the console window on invocation of each function for which a scriptable wrapper existed (basically being able to follow all interpreter to implementation transitions). Currently the console output is quite helpful, but could be more so. thanks, Alastair Paul Emsley wrote: Markus Dehnhardt wrote: > Dear cooters, > > I am new to coot, but I have already discovered how powerful > extensions and key bindings can be. My question is quite simple: if > I want to generate my own extension or keybinding, which scripting > language is better suited? I am not very familiar with either but > willing to experiment. > > There were similar questions already on this mailing list but there > are a couple of things that are not clear to me: > > Some of the documentation is for python some for scheme: "the > scripting interface" is python and the "reference manual" is > scheme. Are all functions awailable for both? Or does one have any > advantage over the other? Sigh... Well, you are not the first person to be confused by this. The state of the scripting documentation has been reported as problematic for a while. I don't know what do to about it that does not involved a lot of work. Yes, the User Manual is mostly written with schemey examples. The reference manual I have not looked at for years :-/, the scripting interface page is also automatically generated and provides an interface from a C-programmers point of view - which is very like that for Python. I use often this quite often. The "scripting interface for functions written in scheme/python" should equivalent access to functions that do the same thing. The syntax of the function calls can be readily converted between scheme and python. There are notes available on how to do this. The functions that we saw today, for example, could have equally well have been written in python. > What is other users preference: python or scheme, and why? For those who are not influenced by me, python I'd say. And they chose python because it is more readily picked up for those with an imperative or object-oriented mind-set. Like the dolphins, I'd choose scheme for exactly the same reasons. > How often do people, other than developers, create extensions? Hard to say, but my feeling is "not often enough". And that is, I suppose, is due to the poor state of the scripting/extension documentation. That and the fact that it takes an investment of time to learn the scripting language, the Coot extensions API and the GUI toolkit. > And finally to the scheme scripters: how did you learn scheme? The Little Schemer and Ken Dybvig's "The Scheme Programming Language". To answer your question: python or scheme? Yes! We provide the best 2 languages so that you have the choice. How to choose? Read "The Little Schemer" - if you think it is delightful and stimulating, use sheme. If you think it is hateful, irrelevant and full of irritating silly parentheses, use python. HTH, Paul.
Re: [COOT] python or scheme
> I am new to coot, but I have already discovered how powerful extensions and > key bindings can be. My question is quite simple: if I want to generate my > own extension or keybinding, which scripting language is better suited? I am > not very familiar with either but willing to experiment. I'd use whichever language you find easier to express whatever you're trying to do. Which one is easier to learn will depend on your programming background. > Some of the documentation is for python some for scheme: "the scripting > interface" is python and the "reference manual" is scheme. Are all functions > awailable for both? Or does one have any advantage over the other? I started using scheme for historical reasons (a few years back I was having trouble building coot, and the linux binaries shipped with scheme enabled) and have stuck with it since. > What is other users preference: python or scheme, and why? How often do > people, other than developers, create extensions? And finally to the scheme > scripters: how did you learn scheme? I almost never write full-blown extensions. On the other hand, it's incredibly useful to have scripting built in to deal with specific situations (stuff like changing the default display of models and symmetry mates to alpha-carbon, or loading a set of maps in one shot). As far as learning scheme, I'd check out SCIP (structure and interpretation of computer programs). Aside from that, it's just another functional language that likes parenthesis. Pete
Re: [COOT] python or scheme
As far as learning scheme, My $0.02: From a purely practical standpoint, if, like me, you have limited time, energy and mental capacity, python would probably yield a better investment payback. There are numerous extensions available that make parsing things like pdb files very simple, there is the whole phenix/ cctbx resource you can make use of, and it is probably the most powerful and commonly employed scripting language among scientists (bioinformatics people like perl, for its text processing abilities). The syntax is very clean and straightforward and you don't have to deal with huge piles of dollar signs and parentheses all over the place. Whichever you use, be sure to use an editor that employs an intelligent syntax highlighting mechanism, like vim, or even emacs (if you type with a lisp). On OS X, TextMate is my editor of choice. Here's a site that lists some of the available modules: http://wiki.python.org/moin/NumericAndScientific HTH, Bill
Re: [COOT] python or scheme
On Thursday 26 February 2009, William G. Scott wrote: > > As far as learning scheme, > > My $0.02: > > From a purely practical standpoint, if, like me, you have limited > time, energy and mental capacity, python would probably yield a better > investment payback. I hope you will pardon my recounting experience to the contrary. I have struggled to learn python, gradually growing to hate it more and more as I go. There must be some fundamental difference in mind-set between my approach to scripting/programming and that of the python crowd. I find it counter-intuitive, seriously limiting in non-obvious ways, and just about impossible to debug. Almost anything else is better - perl, C, scheme, Fortran, ... OK, maybe direct shell scripting is worse. I let myself be talked into using python for several reasonably large projects that I am now left to maintain, and I regret it. I doubt I would ever again choose it for a new project. > There are numerous extensions available that make > parsing things like pdb files very simple, there is the whole phenix/ > cctbx resource you can make use of, and it is probably the most > powerful and commonly employed scripting language among scientists > (bioinformatics people like perl, for its text processing abilities). > The syntax is very clean and straightforward and you don't have to > deal with huge piles of dollar signs and parentheses all over the place. Instead you have to deal with the insanity of a language that is sensitive to whitespace, cannot be 'grep'ed for begin/end blocks, has no decent debuggers that I have been able to find, and has serious problems with incompatibility across incremental updates of the language itself. Granted, most of my rant against python is with regard to using it for new code development, not so much an indictment against using it for casual interaction with an existing program. Anyhow, I'd recommend scheme over python for ease of casual use, even though at this point my experience with scheme is much less than with python. Ethan [not eager to plunge into another python bug-hunt, but probably destined to do so in the near future] > Whichever you use, be sure to use an editor that employs an > intelligent syntax highlighting mechanism, like vim, or even emacs (if > you type with a lisp). On OS X, TextMate is my editor of choice. > > Here's a site that lists some of the available modules: > http://wiki.python.org/moin/NumericAndScientific > > HTH, > > Bill > -- Ethan A Merritt Biomolecular Structure Center University of Washington, Seattle 98195-7742