Re: Syntax Suggestion: Pass Function Definition as Argument

2019-11-11 Thread Rhodri James
On 07/11/2019 13:36, Stephen Waldron wrote: This is how it is at the moment, however it may be more agreeable, especially if that is the only purpose of the function, for python users to be able to define new functions inside of function calls. No, not seeing it. Sorry, I don't think "I don'

Re: Syntax Suggestion: Pass Function Definition as Argument

2019-11-08 Thread Stephen Waldron
Ok firstly, this idea was inspired specifically by a project I'm working on for school concerning linked lists, in which I was trying to create a method that performed a function on elements iteratively without having to navigate the list from the head each time (of course taking the function as

Re: Syntax Suggestion: Pass Function Definition as Argument

2019-11-08 Thread Chris Angelico
On Fri, Nov 8, 2019 at 11:22 PM Antoon Pardon wrote: > > On 8/11/19 13:00, Chris Angelico wrote: > > On Fri, Nov 8, 2019 at 10:57 PM Antoon Pardon wrote: > >> On 7/11/19 18:10, Stephen Waldron wrote: > >>> What I'm aiming for is the ability to, within a function call, pass a > >>> suite that wou

Re: Syntax Suggestion: Pass Function Definition as Argument

2019-11-08 Thread Antoon Pardon
On 8/11/19 13:00, Chris Angelico wrote: > On Fri, Nov 8, 2019 at 10:57 PM Antoon Pardon wrote: >> On 7/11/19 18:10, Stephen Waldron wrote: >>> What I'm aiming for is the ability to, within a function call, pass a suite >>> that would be there automatically defined by the compiler/interpreter. >>

Re: Syntax Suggestion: Pass Function Definition as Argument

2019-11-08 Thread Chris Angelico
On Fri, Nov 8, 2019 at 10:57 PM Antoon Pardon wrote: > > On 7/11/19 18:10, Stephen Waldron wrote: > > What I'm aiming for is the ability to, within a function call, pass a suite > > that would be there automatically defined by the compiler/interpreter. > > Another comment did mention lambda func

Re: Syntax Suggestion: Pass Function Definition as Argument

2019-11-08 Thread Antoon Pardon
On 7/11/19 18:10, Stephen Waldron wrote: > What I'm aiming for is the ability to, within a function call, pass a suite > that would be there automatically defined by the compiler/interpreter. > Another comment did mention lambda functions, which does to some degree > provide that capability, but

RE: Syntax Suggestion: Pass Function Definition as Argument

2019-11-07 Thread David Raymond
Here is it rewritten using the proposal: ``` #Definition def myFoo (str1, str2, foo, str = " "): print( foo(str = str1), foo(str = str2) ) #Call myFoo ("hello", "world!"): str = list(str)[0].upper() + str[1:] return str ``` Are you looking for multi-line l

Re: Syntax Suggestion: Pass Function Definition as Argument

2019-11-07 Thread Stephen Waldron
Thanks Antoon. I do suppose that it is kind of wrong to say the only way is to "reference its [the function's] name" as an argument, however the point I was trying to make was that it isn't possible to pass a function that is either not in some way previously defined or a reference to something

Re: Syntax Suggestion: Pass Function Definition as Argument

2019-11-07 Thread Stephen Waldron
Thanks Antoon. I do suppose that it is kind of wrong to say the only way is to "reference its [the function's] name" as an argument, however the point I was trying to make was that you cannot pass a function that is either not in some way previously defined or a reference to something previously

Re: Syntax Suggestion: Pass Function Definition as Argument

2019-11-07 Thread Antoon Pardon
On 7/11/19 14:36, Stephen Waldron wrote: > Hi, I'm new to the group and to Python, so forgive me if I make any faux-pas > here. As I can tell, the only way to pass a function as an argument is to > reference its name as follows: > > def foo1(message): > print(message) > > def foo2(foo, messag

Syntax Suggestion: Pass Function Definition as Argument

2019-11-07 Thread Stephen Waldron
Hi, I'm new to the group and to Python, so forgive me if I make any faux-pas here. As I can tell, the only way to pass a function as an argument is to reference its name as follows: def foo1(message): print(message) def foo2(foo, message): print("Your function says:") foo(message)

Re: Syntax suggestion.

2006-09-05 Thread samir
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

Re: Syntax suggestion.

2006-09-04 Thread Alex Martelli
samir <[EMAIL PROTECTED]> wrote: ... > 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 coordi

Re: Syntax suggestion.

2006-09-04 Thread samir
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 parenthes

Re: Syntax suggestion.

2006-09-03 Thread Alex Martelli
samir <[EMAIL PROTECTED]> 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 indicat

Re: Syntax suggestion.

2006-09-03 Thread samir
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 R

Re: Syntax suggestion.

2006-09-01 Thread Eirikur Hallgrimsson
>> "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

Re: Syntax suggestion.

2006-09-01 Thread Simon Forman
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 lik

Re: Syntax suggestion.

2006-09-01 Thread samir
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 > complete

Re: Syntax suggestion.

2006-08-31 Thread Roberto Bonvallet
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:

Re: Syntax suggestion.

2006-08-30 Thread George Sakkis
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 -- http://mail.python.org/mailman/listinfo/python-list

Syntax suggestion.

2006-08-30 Thread samir
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 >>> U