Python simulator recommendation [closed] - python

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
Anyone has any python simulator to recommend? am new to python programming. is there any program similar to codeblocks for C++ programming? Thanks

I think you might be slightly confused over terminology.
The term "simulator" doesn't really mean much in the context of programming. A simulator is something which pretends to be some other platform so you can test code on it. For example, I might use an Android simulator or a Gameboy simulator on my computer so I can test code without having to transfer it all the time.
You might mean "IDE" instead. Codeblocks is an example of an IDE. It stands for "Integrated Development System". It combines a "compiler" (something which turns what you write into executable code) and a specialized "text editor" (a program which lets you write text). It also includes a wide variety of convenient features to make programming in C++ more easy.
Note that you technically don't need an IDE to write code. An IDE combines a compiler (or an interpreter, in the case of Python) with a text editor, and a bunch of extra features for convenience, but this is by no means "necessary", strictly speaking. All you need in order to write code is a text editor of some sort, and a compiler or interpreter.
For example, I typically use either Notepad++ or Vim to write my Python code, and run it directly from the command line.
Regardless, Python has a wide variety of IDEs you can look at. Here is a comparison of the most popular ones.
However, you don't necessarily need a fancy IDE to program in Python! If you just directly install Python, it comes with a simple IDE called "IDLE" which you can use to write and run Python code. If you're new to Python, I recommend you use IDLE for now, until you get the hang of things.
tl;dr
To summarize:
A simulator is a program that pretends to be some other kind of computer/platform. Simulators are used to test code.
An IDE stands for "Integrated Development System" and is used to write and run code.
It combines a compiler or interpreter with a text editor.
There are many IDES for Python. Here is a list.
However, I recommend you use IDLE, which is included by default when you install Python.

Codeblocks does have a plugin for Python: http://wiki.codeblocks.org/index.php?title=Python_plugin . Though, I am not sure, how popular that is!
There was a similar discussion on SO: What IDE to use for Python?

Related

How to use together!? Python, Lua, and Ruby? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I'm started programming not too long ago. I use a little of Python, Lua, and Ruby. Is it possible to compile all three scripts into one executable using py2exe, py2app, or py2deb?
If not, which one should I use for game development, and if anyone has any type of resources to study off of, I really would mind learning more.
Combining them all into one executable is hard. Combining them into one application, not so hard.
Let's take py2app as an example. It builds an OS X application bundle—a directory full of files. There's a complete Python interpreter with a custom standard library in the Frameworks subdirectory. And your application's Python source code (and/or .pyc bytecode) and all of your data files are in the Resources subdirectory. Finally, in the MacOS subdirectory, there are two things: a standard python stub executable, which runs Python with your custom standard library, and another stub executable with the name of your app, which runs Python with your custom standard library and executes your main script.
Imagine you had an identical tool for Ruby and Lua.
You could very easily build an application bundle that puts each framework in the Frameworks directory, puts all your source code in all three languages, and all of your data files, into the Resources directory, and puts all three stub executables in the MacOS directory. Whichever one of your scripts is the main program, you'd keep just the stub executable for that one.
As long as your scripts know how to find the python, lua, and ruby stub executables to launch other scripts (which you can do by, e.g., modifying the PATH in the environment at the start of your main script), everything works.
And there's an even simpler solution: py2app (and ruby2app and lua2app) up each application separately, and then just package the complete applications inside the bundle (e.g., in an Applications directory under the Library directory) and just run them that way. The down side is that if you have 20 different Python scripts, you're going to end up with 20 complete Python installations, which gets to be a pretty big download.
But you can go half-way in between: merge all the Python apps into one bundle, all the Ruby apps into another, and all the Lua apps into another.
The problem with doing this in practice are that you don't actually have an identical tool for Ruby and Lua; you have different tools, which build different structures. And you don't have an identical tool for Windows (py2exe builds a very differently-shaped structure, and uses very different configuration settings). So you need to understand (up to) the cartesian product of N*M different structures if you have N languages and M platforms.
And you really do need all the separate tools. py2app can't be used on Ruby or Lua code, or Windows code, because it needs to understand Python modules—including Python C extension modules, which it has to understand at the Mach-O level as well as at the Python API level—in order to figure out the dependencies and get the right files, and figure out the right places to put them in the bundle so the interpreter can find them, and so on.
Still, it's definitely doable—I've worked on two projects that bundled up multiple scripts written in two or three different scripting languages in exactly the way I described above.
No. It might be possible to use the JVM versions of the languages to create JVM classes, then JAR them up. I have never used any of them besides jRuby.
Why use three similar scripting languages at the same time? It's like eating pasta with mashed potatoes and bread.

Scripting Languages [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I am looking for a good scripting language to link to my program.
I am looking for 2 important attributes:
Scripting language should be hard linked into the executable (not requiring 3rd party
installations). This is important to me to simplify distribution.
Scripting should allow some run-time debugging option (When running a script inside my program I would like to easily run it inside a debugger while it is running in the context of my program)
Can python,lua or some other language supply me with this?
Both Lua and Python can provide the features you mention, so choosing one of them will depend on other criteria.
Lua is a lighter weight solution, it will have a much smaller disk footprint and likely a smaller memory overhead than Python too. For some uses it may be faster. Python has a much richer standard library, more mature third party libraries and a more expressive language.
Both have been embedded into major applications. Python can be found in Blender, OpenOffice and Civilization 4. Lua can be found in World of Warcraft and Adobe Lightroom. I'd recommend looking at a few tutorials for each and the facilities available to embed them in your application and just choose the one that fits your brain best.
Lua is designed for this:
static linking? check!
debugging? check!
Typically, Lua is the better choice for embedding into another project. Python is better as a standalone platform because the library support is so much broader. See Lua Versus Python for more details.
Personally, I use both very frequently depending on the job at hand. I always use Lua for embedding into C/C++ applications or scripting functionality that is imported from C/C++ shared libraries (i.e. a DLL). Python is always my first choice for standalone tasks that do not require low-level C/C++ code.
I'd put my two cents in for python. I don't know a lot of the details, but the computer graphics suite blender does a wonderful job of implementing python scripting.
As far as I can tell in blender 2.5 the interpreter is run from inside the executable,
import sys
sys.executable
shows /blender/blender.exe
and there is good debugging support, it even has a full interactive interpreter inside.
For more info check out: http://www.blender.org/
I really like Lua for embedding, but just as another alternative, JavaScript is easily embeddable in C, C++ (SpiderMonkey and V8) and Java (Rhino) programs.
In addition to Tcl, Lua, and Javascript (all already mentioned), Guile is another language designed explicitly for this.
I'll add Tcl to the mix. It's designed to be easily embedded into other programs.

Looking for a bare-bones open-source editor written in python [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I'm looking for a bare bones cross platform editor written in python that I can pick up and customize. The fewer dependencies the better.
Please note: I'm not looking for a python editor or python IDE. Just a no-frills editor, that
I can use as a base for an app that I'm starting on.
Must be open source and free to modify for commercial use since I intend to use this for work.
There is a complete editor written in wxPython here:
http://wiki.wxpython.org/WxHowtoSmallEditor
Only 104 lines, should be easy to customize.
EDIT:
To address some of your requirements, here is a copy and paste from the wxPython wiki:
A GUI Toolkit
wxPython is a GUI toolkit for the Python programming language. It allows Python programmers to create programs with a robust, highly functional graphical user interface, simply and easily. It is implemented as a Python extension module (native code) that wraps the popular wxWindows cross platform GUI library, which is written in C++.
Open Source
Like Python and wxWindows, wxPython is Open Source which means that it is free for anyone to use and the source code is available for anyone to look at and modify. Anyone can contribute fixes or enhancements to the project.
Cross Platform
wxPython is a cross-platform toolkit. This means that with a little care that the same program will run on multiple platforms without modification. Currently supported platforms are Microsoft Windows, and most Unix or unix-like systems with GTK available, and OS X 10.3.9 or above.
How about IDLE? IDLE is included in the standard Python distro. From the docs:
"
IDLE has the following features:
coded in 100% pure Python, using the tkinter GUI toolkit
cross-platform: works on Windows and Unix
multi-window text editor with multiple undo, Python colorizing and many other features, e.g. smart indent and call tips
Python shell window (a.k.a. interactive interpreter)
debugger (not complete, but you can set breakpoints, view and step)
"
With some work, you could probably rip out the editor component from IDLE.
Have a look in the idlelib directory of your Python standard library.
check out:
Scitilla/SciTE
http://www.scintilla.org/SciTE.html
Editra
http://editra.org/
both are cross platform and written in Python. They are full featured editors, but barebones compared to an IDE or such.
Here's a complete editor written in wxPython. It has more functionality than the editor suggested by Andre. It does not yet have a stable release though. https://github.com/0b0bby0/wxEditor.git
It depends on how much functionality you want.

tools to aid in browsing/following (large) python projects' source code [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
A specific example: becoming familiar with django's project source code (core, contrib, utils, etc.). Example of a useful tool: ctags - it allows you to "jump" to the file+location where a function/method is defined. Wondering about other tools that developers use (example: is there a tool that given a function x(), lists the functions that call x() and that are called by x()?). Thanks.
Edit: added an answer with an aggregate of tools mentioned so far in other answers
The following is an aggregate of tools mentioned in other answers...
cscope
http://cscope.sourceforge.net/
wikipedia entry: http://en.wikipedia.org/wiki/Cscope
cscope is a console mode or text-based graphical interface ... It is often used on very large projects to find source code, functions, declarations, definitions and regular expressions given a text string.
pycscope
http://pypi.python.org/pypi/pycscope/
generates a cscope index of Python source trees
ctags and exuberant ctags
http://ctags.sourceforge.net/
http://ctags.sourceforge.net/ctags.html
wikipedia entry: http://en.wikipedia.org/wiki/Ctags
Ctags is a program that generates an index (or tag) file of names found in source and header files of various programming languages. Depending on the language, functions, variables, class members, macros and so on may be indexed. These tags allow definitions to be quickly and easily located by a text editor or other utility.
Eclipse:
http://www.eclipse.org/
wikipedia entry: http://en.wikipedia.org/wiki/Eclipse_%28software%29
Eclipse is a multi-language software development platform comprising an IDE and a plug-in system to extend it. It is written primarily in Java and can be used to develop applications in Java and, by means of the various plug-ins, in other languages as well, including C, C++, COBOL, Python, Perl, PHP, and others.
PyDev
http://pydev.sourceforge.net/
"Pydev is a plugin that enables users to use Eclipse for Python and Jython development -- making Eclipse a first class Python IDE"
Komodo Edit
http://www.activestate.com/komodo_edit/
wikipedia entry: http://en.wikipedia.org/wiki/ActiveState_Komodo
Komodo Edit is a free text editor for dynamic programming languages introduced in January 2007. With the release of version 4.3, Komodo Edit is built on top of the Open Komodo project.
It was developed for programmers who need a multi-language editor with broad functionality, but not the features of an IDE, like debugging, DOM viewer, interactive shells, and source code control integration.
Prashanth's call graph (visualization) tool
http://blog.prashanthellina.com/2007/11/14/generating-call-graphs-for-understanding-and-refactoring-python-code/
Just thought I'd share a link to an interesting small fun script I've found long time ago, that draws a graph of function calls. It works only for simple cases, so "as is" it's more fun than useful.
rope/ropemacs
http://rope.sourceforge.net/ropemacs.html
Ropemacs is a plugin for performing python refactorings in emacs. It uses rope library and pymacs.
http://www.enigmacurry.com/2008/05/09/emacs-as-a-powerful-python-ide/
Wing IDE
http://www.wingware.com/
Wing IDE has goto-definition, find uses, a source browser, refactoring, and other code intelligence features that should help. Another good way to understand unfamiliar Python code is to set a breakpoint, run to it in the debugger, and then go up and down the stack. In Wing Professional you can also use the Debug Probe to interact with and try out things in the debug runtime state (it's a Python shell that runs in the context of the current debug stack frame).
You can maybe try cscope! Wikipedia says that
cscope is often used to search content within C or C++ files, but it can be used to search for content in other languages such as Java, Python, PHP and Perl.[citation needed]
And you can also dig in this project.
Many (or even most, I should say) IDE's help you in this by enabling you do go to variable and function definitions, often by just Ctrl+click, or showing you class overviews where you can see all methods and attributes a class has including those inherited, and letting you go to their definition, etc, etc, etc. I can't recommend such a tool highly enough, it's very time-saving for development.
I personally use WingIDE, which is excellent and has all these features, but you should also check out KomodoEdit and Eclipse+PyDev. There maybe more that I don't know of, and it's fully possible that vim and emacs have some sort of plugins for this.
I think Komodo Edit and PyDev allows you to jump to python function defs.
is there a tool that given a function x(), lists the functions that call x() and that are called by x()?
Just thought I'd share a link to an interesting small fun script I've found long time ago, that draws a graph of function calls. It works only for simple cases, so "as is" it's more fun than useful.
For normal Python development personally I use GNU Emacs with rope/ropemacs (found a video showing the features) and sometimes Eclipse with PyDev.
This is subjective so I think it should probably be a community wiki. That said, the best thing you can probably do to make browsing large projects is to be familiar with hotkeys provided in your favourite IDE. Using the keyboard to browse through large source code is much easier than manually scrolling through text, highlighting text and fumbling through an IDE with a mouse.
Document it as you go. Leave trails, improve the structure, and keep notes. By the time you've found you way around the enter codebase, you'll have a good map.
I like Eclipse and the PyDev plugin. This combination has been very useful to me.
You should notice that cscope targets only the UNIX, Linux OSs.

UNIX shell written in a reasonable language? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
Has anyone ever heard of a UNIX shell written in a reasonable language, like Python?
Eshell is a Bash-like shell in Emacs Lisp.
IPython can be used as a system shell, though the syntax is a bit weird (supporting all of Python plus basic sh constructs).
fish has a core written in C, but much of its functionality is implemented in itself. Unlike many rare shells, it can be used as your login shell.
Hotwire deserves another mention. Its basic design appears to be "PowerShell in Python," but it also does some clever things with UI. The last release was in 2008.
Zoidberg is written in Perl and uses Perl syntax. A nice-looking project, shame it seems to have stalled.
Scsh would be a pain to use as a login shell (an example command from the docs: (run/strings (find "." -name *.c -print))), but it looks like a good "Perl in Scheme."
iPython (Python) and Rush (Ruby) are shells that are designed for more advanced languages. There's also Hotwire, which is sort of a weird integrated shell/terminal emulator.
From all appearances, Python IS a shell. It runs with #! and it can run interactively. Between the os and shutil packages you have all of the features of standard Unix shells.
Since you can do anything in Python with simple, powerful scripts, you don't really need to spend any time messing with the other shells.
Well, there's emacs, which is arguably a shell written in lisp :)
Seriously though, are you looking for a reimplementation of an existing shell design in a different language such as Python? Or are you looking for a new implementation of a shell language that looks similar to your language of choice?
There is xon now:
http://xon.sh/
http://xon.sh/tutorial.html#running-commands
PyCon video - https://www.youtube.com/watch?v=uaje5I22kgE
Tclsh is pretty nice (assuming you like Tcl, of course).
Try rash. It's a shell language written in Racket. It has a nice interactive-friendly syntax. You can embed Rash inside any normal Racket file as well as embedding normal Racket inside Rash. It's extensible and you can define new pipeline operators. It's still alpha quality at the moment, but it's pretty cool. Full disclosure: I wrote it.

Categories

Resources