473,386 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Syntax suggestion.

Saluton!

Being a fond of Python, I had this idea: Why not making Python a Unix
shell?

But, after a little thinking, i found that the current syntax may be
troublesome.

For example: to list files in bash I'll do
$ ls M*
When for Python it will be:
>>import UShell
UShell.ls("M*")
or
>>UShell.exec("ls M*")
So, why not making the use of parentheses when a function is one lined
optional to have commands like this:
>>UShell.ls "M*"
or even
>>ls "M*"
Then, why not making the comma optional too when executing such
instructions:
>>UShell.echo number result
Instead of
>>UShell.echo number,result
And finally, why not making the string parameter "-less when it is the
only parameter:
>>UShell.ls M*
Instead of
>>UShell.ls "M*"

Adiaux
Samir

Aug 30 '06 #1
10 1353
samir wrote:
Saluton!

Being a fond of Python, I had this idea: Why not making Python a Unix
shell?
It's been done; it's called "IPython":
http://ipython.scipy.org/doc/manual/manual.html

George

Aug 30 '06 #2
samir wrote:
Being a fond of Python, I had this idea: Why not making Python a Unix
shell?
[...]
So, why not making the use of parentheses when a function is one lined
optional to have commands like this:
[...]
Then, why not making the comma optional too when executing such
instructions:
[...]
And finally, why not making the string parameter "-less when it is the
only parameter:
....so finally you get something that is exactly like any Unix shell, and
completely different to Python. If you want Python to look like bash, work
like bash and have bash-like syntax, you should really consider using bash :)

--
Roberto Bonvallet
Aug 31 '06 #3
Bonan tagon!

George Sakkis wrote:
It's been done; it's called "IPython":
http://ipython.scipy.org/doc/manual/manual.html
Thank you for the link! It's just what I've needed but...

Roberto Bonvallet wrote :
...so finally you get something that is exactly like any Unix shell, and
completely different to Python. If you want Python to look like bash, work
like bash and have bash-like syntax, you should really consider using bash :)
I'm fedup of typing over and over parentheses around function calls
every time I call a single ligne function call or when it is inside an
"if" statement. So i thought that ommiting the parentheses and, why
not, the commas in such cases will be a sort of beautiful/easier :)

Adiaux
Samir

Sep 1 '06 #4
samir wrote:
Bonan tagon!

George Sakkis wrote:
It's been done; it's called "IPython":
http://ipython.scipy.org/doc/manual/manual.html

Thank you for the link! It's just what I've needed but...

Roberto Bonvallet wrote :
...so finally you get something that is exactly like any Unix shell, and
completely different to Python. If you want Python to look like bash, work
like bash and have bash-like syntax, you should really consider using bash :)

I'm fedup of typing over and over parentheses around function calls
every time I call a single ligne function call or when it is inside an
But think of all the curly braces around code blocks that you've never
had to type! ;-)
"if" statement. So i thought that ommiting the parentheses and, why
not, the commas in such cases will be a sort of beautiful/easier :)

Adiaux
Samir
Sep 1 '06 #5
>"if" statement. So i thought that ommiting the parentheses and, why
not, the commas in such cases will be a sort of beautiful/easier :)

Adiaux
Samir
This actually exists.
The language which omits punctuation not actually required to resolve
ambiguity is called Ruby.
Ruby is subject to a lot of love/hate over this.

Eirikur
Sep 1 '06 #6
Saluton!

Simon Forman wrote:
>But think of all the curly braces around code blocks that you've never
had to type! ;-)

That's why I left java to jython!

Eirikur Hallgrimsson wrote:
>This actually exists.
The language which omits punctuation not actually required to resolve
ambiguity is called Ruby.
>Ruby is subject to a lot of love/hate over this.
It's late, now I talk Python HSSSHSSHS HSSHSS HS :)

I think that Ruby is a good scripting language for game engines but not
as good as Python to do some serious scientific processes (or, at least
Ruby doesn't have all the necessary "batteries").

Talking of games, "Blade of Darkness" was scripted entirely in Python
(1.5 I think)
:)

Sybren Stuvel wrote:
But how would you discern between a function reference and a function
call?
That would be a problem with two solutions:
1- If the function doesn't have any parameters, it will be called with
the empty parentheses (just like usual!);
2- to indicate that this is a function call, we would be adding a $ at
the end of the statement.

Gxis la reskribo
Samir

Sep 3 '06 #7
samir <sa**********@linuxmail.orgwrote:
But how would you discern between a function reference and a function
call?

That would be a problem with two solutions:
1- If the function doesn't have any parameters, it will be called with
the empty parentheses (just like usual!);
2- to indicate that this is a function call, we would be adding a $ at
the end of the statement.
What a mess it would be to disambiguate statements such as

x = foo bar baz bat

is it x = (foo, bar, baz, bat)
or x = foo(bar, baz, bat)
or x = foo(bar(baz), bat)
or x = foo(bar, baz(bat))
or x = foo(bar(baz, bat))
or ... [even ignoring the possibility that one or more of these might be
functions callable without arguments...!!!]...

iPython has some heuristics that may be reasonable for the commandline
(and are, in any case, at least simple), but in practice I find that I
go back to using the good old interactive Python interpreter rather than
putting up with even those simple heuristics.
Alex
Sep 4 '06 #8

Alex Martelli wrote:
What a mess it would be to disambiguate statements such as

x = foo bar baz bat

is it x = (foo, bar, baz, bat)
or x = foo(bar, baz, bat)
or x = foo(bar(baz), bat)
or x = foo(bar, baz(bat))
or x = foo(bar(baz, bat))
It will be x=foo(bar,baz,bat). The parenthese ommition would only be
valable for the first function call in the statement.
or ... [even ignoring the possibility that one or more of these might be
functions callable without arguments...!!!]...
That won''t be a problem: "x=foo bar(baz) bat" would be equivalent to
"x=foo(bar(baz),bat)".
Or, but least realistic, it would be in the scheme trend. For example:

a=b(c,d(e,f(g,h,i,j,k))) <==a=b c (d e (f g h i j k))

It looks nicer, isn't it? :)
iPython has some heuristics that may be reasonable for the commandline
(and are, in any case, at least simple), but in practice I find that I
go back to using the good old interactive Python interpreter rather than
putting up with even those simple heuristics.
That depends of your need to such tools. For example if you need to
copy a file, then, resolve a linear system then chroot and set the
password as de hexadecimal representation of the hash function of pi
multiplied by the averge of the solution coordinations +_+, you'll need
IPython ;)

Sep 4 '06 #9
samir <sa**********@linuxmail.orgwrote:
...
That depends of your need to such tools. For example if you need to
copy a file, then, resolve a linear system then chroot and set the
password as de hexadecimal representation of the hash function of pi
multiplied by the averge of the solution coordinations +_+, you'll need
IPython ;)
GVIM (and the normal Python interpreter) work better for me: to perform
such a task, I would always write (and run) a script, of course (the
purpose of the chroot step is somewhat mysterious here, btw). If I have
to perform a strange and complex task once, it's likely that I will have
to perform some variant of it again in the future, and having the script
around will make it easy to edit and tweak. Furthermore, having the
script around can be a useful indicator when I'm later trying to
reconstruct exactly what it is that I did.
Alex
Sep 4 '06 #10
Saluton!

Alex Martelli wrote:
GVIM (and the normal Python interpreter) work better for me: to perform
such a task, I would always write (and run) a script, of course (the
purpose of the chroot step is somewhat mysterious here, btw). If I have
to perform a strange and complex task once, it's likely that I will have
to perform some variant of it again in the future, and having the script
around will make it easy to edit and tweak. Furthermore, having the
script around can be a useful indicator when I'm later trying to
reconstruct exactly what it is that I did.
And that's what any concious humain will do in such situation. What I
ment is that, sometimes, you have to work in real time and have no time
to code->test->debug->... cycle. For example when monitoring or forging
some IP packets (you can fake a "fantom" Sun workstation in your home
network like that ;) and need a realtime custom check function or when
you're using your computer as a "desk scientific calculator" you'd like
to have a flexible, powerfull and light-weight-syntax interpretted
programming language.

That language would be with no doubt Python! But, why not, with lighter
syntax.

Adiaux!
Samir

Sep 5 '06 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

75
by: David MacQuigg | last post by:
Seems like we need a simple way to extend Python syntax that doesn't break existing syntax or clash with any other syntax in Python, is easy to type, easy to read, and is clearly distinct from the...
24
by: Steven Bethard | last post by:
I think one of the biggest reasons we're having such problems coming to any agreement on decorator syntax is that each proposal makes a number of syntax decisions, not just one. For decorators, I...
12
by: Steven Bethard | last post by:
The poll, as stated, asked voters to vote for the syntax suggestion they liked the /most/. Some of the conclusions people are trying to draw from it are what syntaxes people liked the /least/. ...
7
by: Petr Prikryl | last post by:
Hi, Summary: In my opinion, the C-like prefix increment and decrement operators (++i and --i) should be marked as "syntax error". Current situation: try... (Python 2.4 (#60, ...)) >>> i =...
29
by: shank | last post by:
1) I'm getting this error: Syntax error (missing operator) in query expression on the below statement. Can I get some advice. 2) I searched ASPFAQ and came up blank. Where can find the "rules"...
18
by: robert | last post by:
Using global variables in Python often raises chaos. Other languages use a clear prefix for globals. * you forget to declare a global * or you declare a global too much or in conflict * you...
17
by: Dinsdale | last post by:
I would like to compare a string value to a pre-determined list of other strings. Is there a simple way to do this in one statements like this: if(strMystring.ToUpper() == ("STRING1"| "STRING2"|...
20
by: W Karas | last post by:
Would the fear factor for concepts be slightly reduced if, instead of: concept C<typename T> { typename T::S; int T::mem(); int nonmem(); };
4
by: FM | last post by:
Hi there: My question is about checking my sql-syntax against DB2UDB V9 throug JDBC 2.0 Is there a way to check my syntax,for example "select * from T1"? Thank you for your help. Regards,
8
by: banderson | last post by:
Hello, I have a combo box in which I want to display multiple fields by concatenating the fields together. If one of those concatenated fields is Null, then the combo box does not show anything. To...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.