[SciPy-User] R vs Python for simple interactive data analysis
Sat Aug 27 17:02:28 CDT 2011
On Sat, Aug 27, 2011 at 16:03, Jason Grout <email@example.com> wrote:
> On 8/27/11 1:19 PM, Christopher Jordan-Squire wrote:
>> This comparison might be useful to some people, so I stuck it up on a
>> github repo. My overall impression is that R is much stronger for
>> interactive data analysis. Click on the link for more details why,
>> which are summarized in the README file.
> From the README:
> "In fact, using Python without the IPython qtconsole is practically
> impossible for this sort of cut and paste, interactive analysis.
> The shell IPython doesn't allow it because it automatically adds
> whitespace on multiline bits of code, breaking pre-formatted code's
> alignment. Cutting and pasting works for the standard python shell,
> but then you lose all the advantages of IPython."
> You might use %cpaste in the ipython normal shell to paste without it
> automatically inserting spaces:
> In : %cpaste
> Pasting code; enter '--' alone on the line to stop.
> :if 1>0:
> : print 'hi'
Or even just %paste!
Type: Magic function
Base Class: <type 'instancemethod'>
String Form:<bound method TerminalInteractiveShell.magic_paste of
object at 0x1528770>>
Namespace: IPython internal
Definition: %paste(self, parameter_s='')
Paste & execute a pre-formatted code block from clipboard.
The text is pulled directly from the clipboard without user
intervention and printed back on the screen before execution (unless
the -q flag is given to force quiet mode).
The block is dedented prior to execution to enable execution of method
definitions. '>' and '+' characters at the beginning of a line are
ignored, to allow pasting directly from e-mails, diff files and
doctests (the '...' continuation prompt is also stripped). The
executed block is also assigned to variable named 'pasted_block' for
later editing with '%edit pasted_block'.
You can also pass a variable name as an argument, e.g. '%paste foo'.
This assigns the pasted block to variable 'foo' as string, without
dedenting or executing it (preceding >>> and + is still stripped)
-r: re-executes the block previously entered by cpaste.
-q: quiet mode: do not echo the pasted text back to the terminal.
IPython statements (magics, shell escapes) are not supported (yet).
cpaste: manually paste code into terminal until you mark its end.
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the SciPy-User