Re: Some "pythonic" suggestions for Python

2007-11-12 Thread Hrvoje Niksic
Loic Mahe <[EMAIL PROTECTED]> writes: > Chris M write : >> Multi-return value lambda? Just so you know, there is no concept of >> returning more than one value from a function. > > I wrote: >> * multi return value lambda > > I meant: multiple return statement, not return multiple values > > pseudo

Re: Some "pythonic" suggestions for Python

2007-11-12 Thread Loic Mahe
Chris M write : > Multi-return value lambda? Just so you know, there is no concept of > returning more than one value from a function. I wrote: > * multi return value lambda I meant: multiple return statement, not return multiple values pseudo code here: lambda x: if A return B, if C return D,

Re: Some "pythonic" suggestions for Python

2007-11-10 Thread Neil Cerutti
On 2007-11-10, Terry Reedy <[EMAIL PROTECTED]> wrote: > I think you can regard 'No do statement' as rejected. Some > consider the non-proliferation of loop constructs a feature. I > believe this includes GvR. Non-providing of the standard loop constructs, yes. But loop constructs are plenty prol

Re: Some "pythonic" suggestions for Python

2007-11-09 Thread Tim Roberts
"Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > >Overall, I'd say you don't stand a chance that your proposals will be >adopted. They are minor variations of things that have been proposed & >rejected too often to count - and to be honest: it get's tiresome >beating the same old horses again and

Re: Some "pythonic" suggestions for Python

2007-11-09 Thread Terry Reedy
"Paul Boddie" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | I started tracking some of the complaints about Python and comparing | them to Python 3000's supposed remedies. It's interesting reading: | | http://wiki.python.org/moin/PythonWarts For ' Inconsistent/unpredictable compa

Re: Some "pythonic" suggestions for Python

2007-11-09 Thread Paul Boddie
On 9 Nov, 20:43, Frank Samuelson <[EMAIL PROTECTED]> wrote: > Carl Banks wrote: > > > What you say is correct in principle, but it's senseless to apply it to > > something you use every day, like def. It's like arguing that irregular > > verbs make speech less productive. > > They do for people wh

Re: Some "pythonic" suggestions for Python

2007-11-09 Thread Steven D'Aprano
On Fri, 09 Nov 2007 11:41:24 -0500, Frank Samuelson wrote: >> The ideas are >> *never* fully thought out or materialized, and they invariably invite >> scorn from the user community. > > Of course, they're thought out: They're stolen from another language. > Specifically, the language in which

Re: Some "pythonic" suggestions for Python

2007-11-09 Thread Bruno Desthuilliers
Frank Samuelson a écrit : (snip) >> Arbitrary changes to syntax are never going to fly. It's a lost cause. > > > The changes are not arbitrary. Which ones ? > They are logical, consistent, less > arbitrary and thus more productive. For who ? > If such > changes are a lost cause, that is too

Re: Some "pythonic" suggestions for Python

2007-11-09 Thread Bruno Desthuilliers
Frank Samuelson a écrit : > Bruno Desthuilliers wrote: > >> Yes. Python deliberately choosed to be a statement-based language. >> >>> Why not use the = operator like most other assignments? >> >> >> This dead horse has been beaten to hell and back. >> >> Note that as far as I'm concerned, I may li

Re: Some "pythonic" suggestions for Python

2007-11-09 Thread Cliff Wells
On Thu, 2007-11-08 at 15:00 -0500, Frank Samuelson wrote: > I love Python, and it is one of my 2 favorite > languages. I would suggest that Python steal some > aspects of the S language. In general, I agree that Python has some antiquated concepts at its core (statements being a major one) and th

Re: Some "pythonic" suggestions for Python

2007-11-09 Thread Terry Reedy
"Frank Samuelson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | My impression was that "consistency" was important to Python. Important, but not over-riding of all else. | "Consistency" improves my productivity because I don't have to | keep referring to the manual. Things wo

Re: Some "pythonic" suggestions for Python

2007-11-09 Thread Frank Samuelson
Carl Banks wrote: >> "Consistency" improves my productivity because I don't have to keep >> referring to the manual. Things work the way I expect them to work. > > Really, should we be taking suggestions from someone who needs a manual > to recall the syntax of the def statement? > > What you

Re: Some "pythonic" suggestions for Python

2007-11-09 Thread Marc 'BlackJack' Rintsch
On Fri, 09 Nov 2007 11:41:24 -0500, Frank Samuelson wrote: >> There are at least 2 posts a month by someone who decides that they >> want to re-wire Python syntax. Usually it's because of some particular >> idiom they're used to in another language, > > And python does not use idioms from other

Re: Some "pythonic" suggestions for Python

2007-11-09 Thread Frank Samuelson
So you like my ideas too! > > There are at least 2 posts a month by someone who decides that they > want to re-wire Python syntax. Usually it's because of some particular > idiom they're used to in another language, And python does not use idioms from other languages? > in other cases it's be

Re: Some "pythonic" suggestions for Python

2007-11-09 Thread Chris M
Multi-return value lambda? Just so you know, there is no concept of returning more than one value from a function. def a(): return 1, 2 returns one value - a tuple of (1, 2). lambda: (1, 2) does the same thing. -- http://mail.python.org/mailman/listinfo/python-list

Re: Some "pythonic" suggestions for Python

2007-11-09 Thread Loic Mahe
Frank Samuelson a écrit : > foo = function(x,y) x+y*2 # Example S language code > bar = foo > bar(3,4) > m = lapply( s, foo ) > bb = lapply(s, function(t) t[3]*4 ) Here you want all functions to be lambda functions: you can get something very close to what you want, just like this: foo = lambd

Re: Some "pythonic" suggestions for Python

2007-11-09 Thread Carl Banks
On Nov 9, 9:52 am, Frank Samuelson <[EMAIL PROTECTED]> wrote: > Bruno Desthuilliers wrote: > > Yes. Python deliberately choosed to be a statement-based language. > > >> Why not use the = operator like most other assignments? > > > This dead horse has been beaten to hell and back. > > > Note that as

Re: Some "pythonic" suggestions for Python

2007-11-09 Thread Chris Mellon
On Nov 9, 2007 8:52 AM, Frank Samuelson <[EMAIL PROTECTED]> wrote: > Bruno Desthuilliers wrote: > > > Yes. Python deliberately choosed to be a statement-based language. > > > >> Why not use the = operator like most other assignments? > > > > This dead horse has been beaten to hell and back. > > > >

Re: Some "pythonic" suggestions for Python

2007-11-09 Thread Frank Samuelson
Bruno Desthuilliers wrote: > Yes. Python deliberately choosed to be a statement-based language. > >> Why not use the = operator like most other assignments? > > This dead horse has been beaten to hell and back. > > Note that as far as I'm concerned, I may like an expression-based > Python-insp

Re: Some "pythonic" suggestions for Python

2007-11-09 Thread Duncan Booth
Frank Samuelson <[EMAIL PROTECTED]> wrote: >> It's also not clear how you expect this to work with anything more >> complex than a single expression. How do you handle statements and >> multiple returns? > > >> def foo(x, y): >> L = [] >> try: >> if x[y] % 2: >> print

Re: Some "pythonic" suggestions for Python

2007-11-09 Thread Frank Samuelson
Steven D'Aprano wrote: > Why? What benefit do you gain? > >> Define function objects as "function"s, let users put them where they >> want to. Get rid of lambda, get rid of def, only use = for assignments. > > So you remove two keywords. That's a plus. But then you have to create a > WHOLE lo

Re: Some "pythonic" suggestions for Python

2007-11-09 Thread Duncan Booth
Steven D'Aprano <[EMAIL PROTECTED]> wrote: > Besides, if you want this behaviour, you can add it yourself: > > class mylist(list): > # Untested! > def __getitem__(self, index): > if type(index) is list: > return [self[i] for i in index] > return super(mylist,

Re: Some "pythonic" suggestions for Python

2007-11-09 Thread Duncan Booth
Scott David Daniels <[EMAIL PROTECTED]> wrote: >> To quote a poster at http://www.thescripts.com/forum/thread22741.html, >> "While we are at it, I also don't understand why sequences can't be >> used as indices. Why not, say, l[[2,3]] or l[(2, 3)]? Why a special >> slice concept? " Isn't that un

Re: Some "pythonic" suggestions for Python

2007-11-08 Thread Scott David Daniels
Frank Samuelson wrote: > I love Python, and it is one of my 2 favorite > languages. I would suggest that Python steal some > aspects of the S language. I generally agree with the various naye-sayers, but find one argument missing: > --- > 2. Al

Re: Some "pythonic" suggestions for Python

2007-11-08 Thread Steven D'Aprano
On Thu, 08 Nov 2007 15:00:03 -0500, Frank Samuelson wrote: > 1. Currently in Python > def foo(x,y): ... > assigns the name foo to a function object. Is this pythonic? > > Why not use the = operator like most other assignments? Why? What benefit do you gain? > Define function objects as "func

Re: Some "pythonic" suggestions for Python

2007-11-08 Thread Bruno Desthuilliers
Frank Samuelson a écrit : > I love Python, and it is one of my 2 favorite > languages. I would suggest that Python steal some > aspects of the S language. > > --- > 1. Currently in Python > def foo(x,y): ... > assigns the name foo to a function

Re: Some "pythonic" suggestions for Python

2007-11-08 Thread Ben Finney
Frank Samuelson <[EMAIL PROTECTED]> writes: > I love Python, and it is one of my 2 favorite > languages. I would suggest that Python steal some > aspects of the S language. I would suggest each of these be discussed in a separate thread, each with a specific Subject field, rather than three loos

Re: Some "pythonic" suggestions for Python

2007-11-08 Thread Diez B. Roggisch
Frank Samuelson schrieb: > I love Python, and it is one of my 2 favorite > languages. I would suggest that Python steal some > aspects of the S language. > > --- > 1. Currently in Python > def foo(x,y): ... > assigns the name foo to a function

Re: Some "pythonic" suggestions for Python

2007-11-08 Thread Jarek Zgoda
Frank Samuelson pisze: > foo = function(x,y) x+y*2 # Example S language code Ugly. -- Jarek Zgoda http://zgodowie.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Some "pythonic" suggestions for Python

2007-11-08 Thread Carl Banks
On Nov 8, 3:00 pm, Frank Samuelson <[EMAIL PROTECTED]> wrote: > I know these ideas are not perfect, but I think they > may be better... Fire away. Python isn't Lisp. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Some "pythonic" suggestions for Python

2007-11-08 Thread Raymond Hettinger
On Nov 8, 12:00 pm, Frank Samuelson <[EMAIL PROTECTED]> wrote: > def foo(x,y): ... > assigns the name foo to a function object. > > Why not use the = operator like most other assignments? FWIW, the also binds the __name__ attribute: foo = lambda(x,y): ... foo.__name__ = 'foo' Raymond --

Some "pythonic" suggestions for Python

2007-11-08 Thread Frank Samuelson
I love Python, and it is one of my 2 favorite languages. I would suggest that Python steal some aspects of the S language. --- 1. Currently in Python def foo(x,y): ... assigns the name foo to a function object. Is this pythonic? Why not use t