3 ms·
I think this is a matter of personal preference. At work my primary language is Python and I rarely use the REPL, and when I do, it's a regrettable experience--
by weberc2 7y ago
I think this is a matter of personal preference. At work my primary language is Python and I rarely use the REPL, and when I do, it's a regrettable experience--can't use up arrow to get previous command, can't use arrow keys to move cursor, entering tabs after the `. . .` makes it hard to figure out how many tabs to enter, etc. And of course you can't visualize the whole "program" at a glance like you can in a text editor. Not sure if Python's REPL is just subpar among repls or if I just don't understand how to leverage REPLs for my benefit, but `$EDITOR /tmp/foo.py` just works so much better for me.
- minxomat 7y agoI prefer a scratch file and send-to-repl. Common in e.f. F#
- setr 7y agoBpython is much nicer experience than the native repl, but I still really only use it to call help(), __slots__(), etc and test minor things like forgotten syntaxes; the lack of automatic reloading just makes it to irritating to work on the script itself that way
- kbd 7y ago> when I do, it's a regrettable experience--can't use up arrow to get previous command, can't use arrow keys to move cursor Dunno what's wrong with your readline but what you describe is default Python behavior. Try installing ipython, you'll get all that and more (such as syntax highlighting, multi-line editing, and much more).
- weberc2 7y agoYeah, I'm not sure why, but this happens in VS Code's integrated terminal, which also has other readline-related issues (alt+backspace deletes to the previous space instead of deleting the previous word, for example). In any case, I still don't use the REPL except when I need to dynamically inspect some value (which isn't necessary in Go, since it's statically typed).
- mixmastamyk 7y agoWindows is crippled somewhat on that front, but there are workarounds. Often easier and way more functional to just install a wrapper like ptpython, bpython, ipython, etc.
- weberc2 7y agoI'm using a Mac.
- mixmastamyk 7y agoSounds like a broken terminal configuration. Try running python at the standard terminal and see what it does.
- weberc2 7y agoYeah, like I said, it works at a standard terminal, not in the VS Code integrated terminal.
- deleted 7y ago[deleted]
- jpittis 7y agoI’ve often had similar feelings to you. Something that blew my mind recently was using a Lisp repl which was integrated with my text editor. I just wrote out the code I wanted to toy with in my text editor buffer, and then highlighted it and hit a key command to evaluate it at the repl without even needing to switch over to the repl window. It would be so cool if we had great support for something similar in non Lisp languages.
- jrimbault 7y agoFor about a year now I've used ipython as my day-to-day python REPL. I'll type a bit in ipython then save that session to a file, tidy up that file, and voila, a full script, now I can repeat that session at will. Ipython has interactive tab completion (including for imports and locally defined symbols), syntax highlighting, (sane) auto indenting, all in the REPL. It's the foundation of jupyter notebooks.
- mbar84 7y agoI have a keyboard shortcut Ctrl+Alt+i mapped to this: alacritty -e /home/mbarkhau/bin/ipy and /home/mbarkhau/bin/ipy is this /home/mbarkhau/miniconda3/envs/py37/bin/ipython -i -c import itertools as it; from statistics import ;import functools as ft;import operator as op;import io;import pathlib as pl;import pandas as pd;import numpy as np;import typing as typ;from math import ;import enum;import re;import sys;import os;import ujson as json;import collections;import random;import decimal;import fractions;import time;import datetime as dt;" I must use it dozens of times a day.