Posts: 4,654
Threads: 1,497
Joined: Sep 2016
i am wanting to come up with an easy way to express Python logic in a single line of tokenized text like that which comes from command arguments in sys.argv. the way it can be done, now, is by having each token be a whole code line, preceded by spaces for the indentation. my goal is to come up with another way to express Python logic as tokenized text which is simpler for a human to type in within the constraints of command line arguments. the existing means is simple to convert to use with the "python -c" command. my goal is to shift most of the burden of expression from human to computer. then the new form would be converted for use with the "python -c" command. this new form may well have no indentation at all, such as a C-like form. but it doesn't have to be C-like. this is a form intended for short logic that can fit on a command line.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Posts: 4,654
Threads: 1,497
Joined: Sep 2016
(Feb-26-2022, 10:22 AM)ndc85430 Wrote: Why? What is the use case for such a thing?
to be able to include logic within a command typed in at a CLI as part of that command's arguments. i've been doing this with a few languages but none are compact enough for quick one-time code. for example, python takes much effort to get the indentation right (in a command line).
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Posts: 4,654
Threads: 1,497
Joined: Sep 2016
writing the code in a file is an extra step making the effort more burdensome. this would be code to type in quickly as part of doing a quick command. well, at least i do commands quickly.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Posts: 4,654
Threads: 1,497
Joined: Sep 2016
i have no examples, yet. if you can't imagine any, you probably don't do commands as much as i do (2000-6000 a day).
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Posts: 4,654
Threads: 1,497
Joined: Sep 2016
(Mar-02-2022, 06:54 AM)Gribouillis Wrote: In Bash, if you type Ctrl-x Ctrl-e it starts the editor defined by $EDITOR to edit the command that you want to type. When you close and save the editor, it runs the command. I use jed as $EDITOR for this. Younger people would probably use nano.
i'm still trying to get this in a command line. it may be entered via sudo and/or ssh, for example.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.