5

As anyone who has used Smalltalk knows, one of the main benefits (other than a late-bound language that discourages many poor practices), is that the system is totally transparent and reflective, which makes understanding APIs and existing code easy, and locating functionality pretty easy.

Is there anything that creates a similar environment for Python?

A few examples of features of a smalltalk development environment, not natively found in python are:

  • search class/method/etc names,
  • examine inheritance hierarchies
  • functionality to show the full interface of a given class/object, and where the properties therein originate
  • an integrated graphical debugger which allows one to examine the full state of everything in the system, and see every instance of a given type, as well as all threads.

Note that I use windows, so anything that works well on windows would be particularly useful.

Mark Booth
  • 14,214
  • 3
  • 40
  • 79
Marcin
  • 498
  • 4
  • 12
  • 1
    What's wrong with the `help()` function that's already part of Python? – S.Lott Dec 26 '11 at 19:39
  • 10
    @S.Lott: Have you ever user a proper smalltalk environment? Comparing `help()` with a smalltalk environment is like comparing unorganised stone tablets with the Library of Congress. Sure, the data is there, but the difference is organisation and navigation. – Marcin Dec 26 '11 at 20:07
  • Are you saying that only Smalltalk's environment is acceptable? I'm not clear on how to answer the question if that's the case. I was hoping for clarification as to what -- specific -- issues you had with help. It would be helpful to **update** the question with something more specific. If you make knowledge of smalltalk a pre-requisite for answering the question, you may not get the kind of help you're looking for. – S.Lott Dec 26 '11 at 20:16
  • @S.Lott: I'm open to any suggestions, but if you think `help()` is the nirvana of reflective programming, then that's not what I'm asking for. I hope that there are some programmers who are familiar with both smalltalk and python, and know what I mean about the difference between that, and pretty much every other environment. The language/execution level capabilities in python should be up to creating something just as good - I want to know if anyone has taken that step. – Marcin Dec 26 '11 at 20:20
  • "I hope that there are some programmers who are familiar with both smalltalk and python," Rather than hope, you can provide some definition of the features you're looking for. – S.Lott Dec 26 '11 at 20:23
  • 8
    @S.Lott: I think his definition of "looks like a Smaltalk environment" is clear enough. – hugomg Dec 26 '11 at 21:04
  • @missingno: Good for you. Sadly, it's not even close to clear for others. – S.Lott Dec 26 '11 at 23:34
  • @S.Lott: You are asking me to specify a full IDE. You are also the only one complaining that this question is insufficiently clear. – Marcin Dec 26 '11 at 23:38
  • 1
    @Marcin: I'm sorry the question is unclear. I'd love to be able to help. I've use a large, large number of IDE's. However, since you refuse to specify what's **important** to you, I cannot offer help. Since you have relatively few answers, you can take that as a hint that your question isn't very clear. Or you can complain that people ask for details before they try to offer incomplete or inaccurate help. If you want help, consider meeting people half way. Or. If you don't want help, try complaining. – S.Lott Dec 27 '11 at 02:48
  • @MarkBooth: For a start, I would expect it to have a gui which works (the ipython gui certainly doesn't run on my machine). I would also expect, at a minimum, to be able to search class/method/etc names, to be able to examine inheritance hierarchies, to have functionality to show the full interface of a given class/object, and where the properties therein originate. I'd like to have an integrated graphical debugger which allows me to examine the full state of everything in the system, and see every instance of a given type, as well as all threads. That's just off the top of my head. – Marcin Jan 04 '12 at 17:52
  • Thanks for the edit Marcin, now it's probably time to clean up these comments. – Mark Booth Jan 05 '12 at 10:16

5 Answers5

8

Having worked with Smalltalk myself for two years, I can tell you I haven't seen any Python IDE available that will give you the level of expressiveness you are looking for in Smalltalk IDEs such as VisualWorks or Squeak.

The key thing about most Smalltalk IDEs is that code + development tools are stored in the same place. So rather than coding in a text editor, then compiling/interpreting it on a VM, It's all done on the same binary. This has obvious benefits as you could connect to a Smalltalk image in a production environment and start coding/debugging on the image itself rather than having to change then publish a new copy as everything is already there. The main drawback I found with this approach is the amount of memory it consumes. You can obviously strip the image down to remedy this, but that takes time.

I will say that it's not impossible to have a Python IDE that does this, but there simply isn't one available as far as I've seen. Despite the dynamic nature of both languages, the approach to development between both languages different given that Python is file based and Smalltalk is image based.

Robert Harvey
  • 198,589
  • 55
  • 464
  • 673
Desolate Planet
  • 6,038
  • 3
  • 29
  • 38
  • 1
    OK, good to hear from someone who clearly gets the question. I don't think that the mere fact of having code stored in files really forces much on us - at the abstract level with python we work with packages rather than files (that isn't to say that python IDEs don't in practice adopt a file-based world view). – Marcin Jan 05 '12 at 11:04
  • A bit of history. The Smalltalk boys and girls that developed VisualAge IDE where asked to develop a Java based implementation of their IDE, which everyone knows as Eclipse. Some of the features you see in that will look the same, it's simply nowhere near as expressive. I struggled to get into Smalltalk in the beginning coming from a Java background, but it grew on me and got me back into Python again. The Smalltalk developers I've worked with were more keen on Ruby than Python though, which was interesting :) – Desolate Planet Jan 05 '12 at 11:22
  • @Marcin, I agree with what your saying and it would be good to have an IDE for Python that does this. Even the code stored on Smalltalk image is backed up by it's own version controlled changelog files. That level of expressiveness your looking for is difficult to attain when components such as the debugger/compiler etc are not running in harmony with the code. So having everything in the same place is really what makes it work. Above and beyond that, the Smalltalk community have done a good job of doing it properly as it's very easy and productive to work with. – Desolate Planet Jan 05 '12 at 11:25
  • 2
    I think we are in agreement. I think Ruby is more smalltalk like, but their culture is more like the worst of lisp weenies: poor documentation, hostile to anyone who mentions the plank in their eyes. – Marcin Jan 05 '12 at 11:35
  • 1
    The point of that last comment, I should clarify, was not to have an unnecessary crack at ruby users, but rather to say that I think the python culture is closer to that of the smalltalk community. – Marcin Jan 05 '12 at 11:45
3

ipython adds lots of syntactic sugar over the default Python REPL. In particualr, you get tab-completion, a nice "?" shortcut for the help() function and everything is nicely colorized and easier to read.

Not quite a Smalltalk environment but I find it very helpful.

hugomg
  • 2,102
  • 13
  • 17
  • Thank you - any experience with using this on windows? – Marcin Dec 26 '11 at 21:48
  • @Marcin: It only runs on Windows. – S.Lott Dec 27 '11 at 12:06
  • 1
    Well, the command line REPL works on LINUX at least (thats what I use anyway). – hugomg Dec 27 '11 at 13:23
  • Sorry. Yes, I was thinking this was Iron Python. – S.Lott Jan 04 '12 at 17:36
  • 1
    Feel free to tidy up you comments any time then. *8') – Mark Booth Jan 04 '12 at 17:44
  • You can have a look at [Pydee](http://code.google.com/p/pydee) or [NinjaIDE](http://ninja-ide.org). Among other things NinjaIDE has a good code locator and symbols explorer. Both works on windows. If you are a super fast typer, then ipython would be the best bet. Pydee comes with ipython built-in. But I don't think it could exactly match SmallTalk features but the above are the better alternatives coupled with ipython – Ubermensch Jan 05 '12 at 11:49
  • ipython does work on Linux, and it's available for both Python 2 and Python 3. – inquiryqueue Jul 31 '14 at 00:09
2

I sometimes find myself using PythonWin's IDE just for the gui available during debugging (run using 'Step-through in the debugger' then show the Stack View). I've never touched smalltalk, though, so I might be way off base...enter image description here

tugs
  • 230
  • 1
  • 3
0

You can't really expect a Smalltalk-like Python IDE. In Smalltalk, the IDE is an integral part of the runtime (or "image").

Nemanja Trifunovic
  • 6,815
  • 1
  • 26
  • 34
  • 1
    I don't see why not. Python has extremely good reflective capabilities. Whether or not the IDE is "integral" (which I don't think is true - you can dump out all of that code from your image if you want) is neither here nor there. – Marcin Jan 04 '12 at 21:46
  • 1
    @Marcin, as I said in my own answer, it's not entirely impossible to develop a Python IDE to give you this feature. It simply comes down to two different approaches to developing software. One being file based, there other being image based. So I wouldn't say Nemanja's answer is wrong, but I would also argue that it's not impossible to have an IDE that can do this. – Desolate Planet Jan 05 '12 at 10:59
0

There is one fundamental difference between the Smalltalk world and Python world. In Smalltalk, one works with an image, whereas in Python there is a distinct static and dynamic view of the program/project.

The usual way of bridging this difference on the Python side consists of improving the static analysis tooling, and in making interacting with a running program easier by being able to run small chunks of a program often, and examining the running program in a debugger, or tool such as Jupyter Notebook.

Let me talk about PyCharm (https://www.jetbrains.com/pycharm/) as my IDE of choice.

Static

PyCharm has decent static analysis capabilities, and one may put in static type hints to assist it https://www.jetbrains.com/help/pycharm/type-hinting-in-product.html

Dynamic

The road to being able to run small chunks of your program often are unit tests, naturally. If you have these, you should always be able to find/write a test which will recreate the program state you are interested in inspecting.

In Python, we rarely (never?) think in terms of "full state of everything in the system". That is probably a Smalltalkism.

Combination of the two

There is a PyCharm feature which enriches the static view of the program by information collected at runtime during debugging sessions https://blog.jetbrains.com/pycharm/2013/02/dynamic-runtime-type-inference-in-pycharm-2-7/

user7610
  • 419
  • 4
  • 13