On Thursday, December 21, 2017 at 7:12:24 AM UTC+5:30, Peng Yu wrote: > Hi, > > R has the function edit() which allows the editing of the definition > of a function. Does python have something similar so that users can > edit python functions on the fly? Thanks. > > https://www.rdocumentation.org/packages/utils/versions/3.4.3/topics/edit
Dunno What exactly you are asking And I suspect an “impedance mismatch” between the answers you are receiving and what you seek. Firstly on briefly looking at the R-docs that you quote I see that it does not guarantee a faithful 'deparsing'… which I interpret as saying that R may present to you a different (looking) function on (re) editing than what you typed The real problem is that in the scale of religious dogmas python community puts inter-OS portability/stability etc over and above development environment This means that the tutorial is woefully inadequate (mostly by omission) in terms of recommending a suitable dev environment. And almost suggests that the basic interactive python shell is enough for writing/trying out python code. This is patently false An experienced programmer either: - Writes scripts (or GUI programs or web-apps or ...) using a full-featured editor like vim Or - Uses a dev-environment — IDLE, emacs, pycharm, pydev, jupyter, org-babel… probably a dozen reasonable choices and hundreds of less reasonable ones In either of these cases the question that you ask does not arise because the code you are working on is always there "in another window" - one click away from being tried out - one click away from being edited (in its actual and not "deparsed" form) <myself> I tend to use emacs My students suffer me and my habits As an editor its really clunky obsolete and asinine But its not an editor; its an OS and in that sphere there is nothing else for competition However I would not make this recommendation for emacs over the net [Learning a dev-environment is like learning a musical instrument : not convenient over the net] </myself> To a beginner I would recommend IDLE by default unless there is significant data pushing another choice And if you try that you will see your question becomes automatically answered (or irrelevant) -- https://mail.python.org/mailman/listinfo/python-list