UserLinux chooses Python as "interpretive language" of choice

S

Steve Lamb

It doesn't matter. As you can see by my reply to Bengt,
the crux of the issue is that, in Ruby, the function call
syntax is *optional.* There is no way to make it optional
in Python, and it is not clear whether it should be.

It is quite clear. I, and others, have shown why several times.
What I'm missing, however, is any *thoughtful*
discussion of the issues involved. Your [perjoritive
adverb deleted] response makes it clear that you
didn't think of the issues, you just reacted.

No, I didn't react and I have thought. Want to know my thinking? 5+
years of programming Perl professionally and being damned tired of trying to
debug not only other people's code but even *my own code* which I wrote before
I restricted myself to using as few implicit calls as I could get away with.
I've gone on to argue against main implicit calls in various different
languages in several different venues (here, Debian lists, in the workplace,
in private discussions, etc) and provided examples why the ambiguity sets up
the programmer, the program and the maintainer for problems down the road.

Now just because you weren't around to see all of this or be in on any of
it doesn't mean it didn't happen. Furthermore it also does not mean that
every time some neophyte comes in throwing languages wishes which have been
discussed at great length several times before that we have to engage in the
same weeks long discussion AGAIN just for his sole benefit! No, we give
concise examples on why that position is the way it is.

That's what you got. You chose to ignore it. Instead of engaging in the
valid points present you ignored them and flamed me. Bravo, way to get your
point across. So until you can address these points I strongly suggest you
not reply because the chances of you making any serious headway without
addressing them is on you. Great thought HAS been put into them. So far no
thought has apparently been put in your position.

1: Calling a function or method without parameters occurs far, far less than
calling a function or method with parameters. This constitutes a special
case.

2: Making the calling syntax optional creates ambiguity because one does not
know if we're making an assignment to the function/method object or an
assignment to the results of the function/method.

3: Making the calling syntax optional creates ambiguity for the maintainer
since it muddles the visual difference between variables and function/method
names.

4: Making the calling syntax optional dictates that to maintain functionality
additional syntax need be created to address the case where one wants to
assign to a function/method ojbect and not to the return of said object.

5: In doing all of the above we have now introduced multiple ways to do the
same thing on 2 different occasions.

The onus is on you to explain, given these statements that we Python
programmers tend to like to adhere to...

Explicit is better than implicit.
Simple is better than complex.
Special cases aren't special enough to break the rules.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.

...why the behavior is desireable when it is implicit, complex guess on a
special case that introduces an additional way to do something which combined
means the language is harder to read and maintian all so you can save two
whole shifted keystrokes.
 
S

Steve Lamb

Ville Vainio said:
If the extra features [...] were really
worthwhile, they would be added to Python
Down that path lies madness (i.e. Perl).

Nono, that's not the quote!


YODA: Code! Yes. A programmer's strength flows from code
maintainability. But beware of Perl. Terse syntax... more than
one way to do it...default variables. The dark side of code
maintainability are they. Easily they flow, quick to join you
when code you write. If once you start down the dark path,
forever will it dominate your destiny, consume you it will.
 
J

John Roth

Steve Lamb said:
It is quite clear. I, and others, have shown why several times.

It's clear that it should be? No, that's clearly not what
you meant.

Remainder of rant snipped.

John Rothsouls.

As I said before, you are not and will never be.
 
B

Bengt Richter

Bengt Richter said:
a third is the ability to forget the empty parenthesis after
a function/method call that doesn't require parameters.

class ThisIs:
avariable = 'a'
def amethod(self):
return 'b'

thisis = ThisIs()
print thisis.avariable
print thisis.amethod()
import this
print "Read line 2."

I'm not sure what your point is. Your example isn't going
to produce the expected result if you say:

print thisis.amethod

instead of

print thisis.amethod()

That is the place where I find Ruby syntax to be
helpful: the amount of time where I want the method /
function object is *far* lower than the amount of
time I want to call it. It's one of those conundrums
that doesn't seem to have a clean answer, though.
Ok, for line 2, run this ;-)

class ThisIs:
avariable = 'a'
def amethod(self):
return 'b'
def silly(self):
return 'heh'
silly = property(silly)

thisis = ThisIs()
print thisis.avariable
print thisis.amethod()
print thisis.silly
import sys
class L2(list):
def write(self, s): self.append(s)
sys.stdout = L2()
import this
L2 = ''.join(sys.stdout).splitlines()[2]
sys.stdout = sys.__stdout__
print "Read line 2."
print '... which is:', L2

Regards,
Bengt Richter

I think you're missing the point I was trying to make.
Sorry, I was being superficial. BTW, the output of the above is
----
a
b
heh
Read line 2.
.... which is: Beautiful is better than ugly.
----
;-)
Sure, you can use a property to not have to put
in the explicit function call, but then you can't put
in the explicit function call *anywhere* you use that
property.
Nor can you supply explicit arguments if you want to, though you could
provide an alternate name, so you could access either way.
Nor can we do properties without accessing them via the attribute magic (i.e.,
not via bare global names for example).
Ruby syntax makes it *optional*. That's what is
missing here.
I've floated various ideas/brain_farts more/less seriously for triggering magic
via name access alterantive to getattr magic, but there seems to be no enthusiasm
or else horrification at the thought, so I haven't stirred that pot for some time ;-)

What would be the syntax you would like to use, with what effect?

Regards,
Bengt Richter
 
D

Donn Cave

Quoth "John Roth" <[email protected]>:
....
| The world changes, and ideas that seemed to be perfectly appropriate
| five or ten years ago may no longer be such. Small languages with a limited
| audience have a perfect right to be as quirky or as "pure" as their authors
| want. Once they get beyond that point, there's a bit of social responsibility
| involved in addressing common problems.

For some definition of "common problems", that might be somewhat
true, though perhaps stretching it a bit even at that. We are
after all talking about free as in beer.

The things we seem to be discussing in this thread do not at all
meet the definition I have in mind. The main point when evaluating
a "common problem" in this context is whether it's really a problem.

Donn
 
S

Skip Montanaro

John> The world changes, and ideas that seemed to be perfectly
John> appropriate five or ten years ago may no longer be such. Small
John> languages with a limited audience have a perfect right to be as
John> quirky or as "pure" as their authors want. Once they get beyond
John> that point, there's a bit of social responsibility involved in
John> addressing common problems.

So fork Python and show how it could be done better. If that's the case,
people will either drift over to Python-JR, or (some of) your ideas will
find their way back into Python-GvR.

Or, as in the Emacs/XEmacs split, darts may be thrown across the void for
the forseeable future. ;-)

Skip
 
H

H.V

Skip Montanaro said:
Python's design doesn't admit the option of calling functions without the
parens. Perl's and Ruby's do. On the other hand, functions are first-class
objects in Python.

And that's a big plus for python. Forget this silliness about calling
functions without parentheses .

John> The jihad against the "functional" builtins is a good case in
John> point. The replacements for apply, map and filter seem to be
John> adequate, and in the case of list comprehensions, pretty darned
John> useful although I think that it's a rather baroque addition to an
John> otherwise very clear and comprehensible language.

I love LC's personally. They do replace map and filter completely and
do so in a very attractive manner. Which is not to say that i am
against map and filter but at least a 100% equivalent construct takes
their place (soon to be replaced by gen conprehensions, which is fine
by me as it's again a clean replacement)


Why do you call it a "jihad"? Guido has stated on multiple occasions that
he regretted adding functional constructs to the language. I still can't
get to the Python website (have to wait another two hours for my ISP to
reload its tables), but here's a Google pointer to an HTML-ized version of
his OSCON 2002 Powerpoint slides:

Given all that Guido has said about functional programming, i'm
starting to wonder why he even made functions first class in python .

http://216.239.41.104/search?q=cach...ets.ppt+OSCON+"python+regrets"&hl=en&ie=UTF-8

John> On the other hand, claiming that sum() is an adequate replacement
John> for reduce() is so silly that it borders on the absurd.

No, operationally that's a correct statement. People have looked at the use
of reduce() in a number of different contexts. In all but the rarest of
cases, reduce() was used to sum a list of numbers. sum() is a perfectly
adequate replacement in all but those rare cases and is easier to read as
well. As Guido mentioned in the talk I referenced above:

reduce()
nobody uses it, few understand it
a for loop is clearer & (usually) faster

I think no one even tries to understand the very concept of reducing
sequence to a single object using a rule . Sum is not a replacement of
this *concept*.
Just what is so wrong with having such a general tool available in a
programming language ? Doesn't it hurt to understand how to use it?

John> The only explanation I can come up with for that level of
John> absurdity is a desire to get rid of a feature, regardless of what
John> it looks like. In other words, a jihad (holy war.)
If you look at some recent python-dev threads, you'll see comments
similar to "..this should get rid of most of the uses of lambdas, we
only have a few cases left .." .
I just don't understand this burning need of some to make python
conceptually poorer by eliminating the very idea of an anonymous
function.


No, it's simply not used very much. Python never has been a very strong
functional language. It's always been a very strong object-oriented
language. Use it the way it's strongest.

I think Guido should put his money where his mouth is and simply
eliminate functions as first class objects then ! It'd be a clear and
definitive way of saying that he doesn't like functional programming.
Object oriented purists probably wouldn't care since they probably
never use functions in that way.
It'd also be a great relief for all those who find the idea of
functions being passed around "hopelessly hard, too complex, byzantine
because i prefer 36 nested for loops with breaks, continues because
they're sooo much easier to understand, etc " .
Then python can be exactly like java at last !

Think about it : As long as functions remain first class, some people
will program using a functional style (I surely intend to). The only
way to stop me from doing that is to remove functions from first class
status. If python ever gets very fast, people will reimplement things
like reduce in their own code or in a functional module.

John> There is no replacement for lambda in sight, even though lambda is
John> arguably the ***largest single*** one of the functional constructs
John> that needs work, and has obviously needed work for a long time.

Once again, you desire Python to be something it is not. If you want a
strong functional language, program in Lisp or Haskell.

Functions are supposedly first class, regular objects in python. Why
can't they be sometimes anonymous, just like tuples, lists and user
defined objects can ? One doesn't even need to consider other
languages to make this point.


John> The obvious replacement for lambda, which is some form of inline
John> block, has not been seriously discussed, with proposed syntax and
John> examples, anywhere I've seen it. Clearly, I'm not ominiscient, so
John> that doesn't mean it hasn't, though.

Anonymous blocks are not a replacement for lambdas, named functions are.

Are there objects in python that must always have a name in any
context whatsoever ? It seems to me that all objects even modules can
be anonymous in at least some context.
Why are people even wondering about adding code blocks when making
real anonymous functions work will do ?

I don't even get why some people who are against the anonymity of
lambdas seem quite ok with the anonymity of code blocks (given how
much more complex a code block can be compared to a lambda, how can
anonymity in their case be fine and not fine in the case of the much
simpler lambdas ?) .

Does anyone care about consistency in python ? For real, if you don't
want functional programming, make functions non first class and stop
claiming that they are objects just like every object.


You seem to have a burr under your saddle about this stuff. I'm not sure
why. Maybe it's time to get out the curry comb...

Skip

svlf
 
S

Skip Montanaro

John> On the other hand, claiming that sum() is an adequate replacement
John> for reduce() is so silly that it borders on the absurd.

HV> I think no one even tries to understand the very concept of reducing
HV> sequence to a single object using a rule . Sum is not a replacement
HV> of this *concept*. Just what is so wrong with having such a general
HV> tool available in a programming language ? Doesn't it hurt to
HV> understand how to use it?

It doesn't hurt to understand the concept of reduce(), but if it's never (or
very rarely) used, it's just extra (nearly dead) code which has to be
maintained. It's easy enough to write reduce() in Python, and if/when PyPy
is a reality shouldn't be any less efficient than the current C version.

HV> I think Guido should put his money where his mouth is and simply
HV> eliminate functions as first class objects then !

There are lots of use cases for functions as first class objects which don't
intersect with the usual notions of functional programming. Here's one
rather silly example:

l = []
append = l.append
for i in range(25):
append(i)

Another less silly example is os.walk(). It's in some sense a specialized
map() function, so does overlap a bit more with the usual notion of
functional programming.

HV> If python ever gets very fast, people will reimplement things like
HV> reduce in their own code or in a functional module.

As well they should. It's a five-liner in Python. I've never used it for
anything but summing a list of numbers. That appears to be true of most
people.

John> There is no replacement for lambda in sight, even though lambda is
John> arguably the ***largest single*** one of the functional constructs
John> that needs work, and has obviously needed work for a long time.

HV> Functions are supposedly first class, regular objects in python. Why
HV> can't they be sometimes anonymous, just like tuples, lists and user
HV> defined objects can ? One doesn't even need to consider other
HV> languages to make this point.

Having functions as first-class objects doesn't mean you have to be able to
define anonymous functions. Functions as first-class objects worked just
fine before Guido introduced lambda to the language in Python 1.0.

HV> Does anyone care about consistency in python ? For real, if you
HV> don't want functional programming, make functions non first class
HV> and stop claiming that they are objects just like every object.

As I indicated above, "functions as first-class objects" is not synonymous
with "functional programming". There are plenty of uses for function
objects without considering map(), apply(), lambda(), filter(), reduce() and
friends.

Skip
 
P

Paul Rubin

I think no one even tries to understand the very concept of reducing
sequence to a single object using a rule . Sum is not a replacement of
this *concept*.
Just what is so wrong with having such a general tool available in a
programming language ? Doesn't it hurt to understand how to use it?

The new sum function actually seems like a kludge around a misdesign
of the operator module. operator.add(2,3,4) should return 9 instead
of throwing an error because operator.add can only take two args.
Then sum(some_list) can be replaced by operator.add(some_list). The
other functions in the operator module should be extended the same way.
 
F

Francis Avila

H.V wrote in message said:
Skip Montanaro <[email protected]> wrote in message
Given all that Guido has said about functional programming, i'm
starting to wonder why he even made functions first class in python .

He didn't make them first-class. He made everything an object, which has
the consequence of making everything first-class.
I think no one even tries to understand the very concept of reducing
sequence to a single object using a rule . Sum is not a replacement of
this *concept*.
Just what is so wrong with having such a general tool available in a
programming language ? Doesn't it hurt to understand how to use it?

No, but it was deemed to not be useful or idiomatic enough to warrant a
builtin. The most common use-case (like, 99% most common) was simply
summing up numbers, so we got a clear and conscise (and faster) builtin for
that, and continue to do things idiomatically for the other use cases.

I tend to agree with this. I've never found a use for reduce, even trying
hard to think of where I might find a home for it in my code. All I've ever
done with it is sum things. Even the Numeric people don't seem to use
reduce, and it seems that they, of all people, would use it. It's simply,
for whatever reason, not Pythonic. People naturally gravitate to alternate
idioms to do things that reduce could do.

Whether sum itself should be a builtin instead of in math is another issue
altogether, but removing reduce from the builtins definately seems like a
good decision to me. It may not be the right decision in some other
language, but for whatever reason, Python doesn't use it much.
If you look at some recent python-dev threads, you'll see comments
similar to "..this should get rid of most of the uses of lambdas, we
only have a few cases left .." .
I just don't understand this burning need of some to make python
conceptually poorer by eliminating the very idea of an anonymous
function.

Python isn't really big on being conceptually pure, just on being clean,
consistent, and easy-to-use and understand.

I think the drive to get rid of usecases for lambdas is rather the opposite
of what you seem to suspect: lambdas have so few uses as it is, that the
Pythonic bent towards using fewer keywords/builtins/constructs has inclined
people to see if those few use-cases are really unique enough to warrant the
special syntax, or if it can somehow be subsumed and eliminated by other,
more generally useful constructs.

I will argue in the following that lambda simply isn't very useful *to*
*Python.*
I think Guido should put his money where his mouth is and simply
eliminate functions as first class objects then ! It'd be a clear and
definitive way of saying that he doesn't like functional programming.
Object oriented purists probably wouldn't care since they probably
never use functions in that way.
It'd also be a great relief for all those who find the idea of
functions being passed around "hopelessly hard, too complex, byzantine
because i prefer 36 nested for loops with breaks, continues because
they're sooo much easier to understand, etc " .
Then python can be exactly like java at last !

You've got it backwards: functions are first-class in Python *because*
everything in Python is an object. (Did you notice that functions have
attributes, like objects?) It would be impossible to make them *not* first
class! (Well, I guess not impossible, but it would require enormous kludgy
hacking at core Python internals, and will inevitably result in bugs that
would haunt Python for the rest of its days. Besides, it's inconsistent,
and Python hates special-cases.)

Anyway, the following is a fantastically common and powerful Python idiom
that requires functions (well, really methods) to be first-class:

class Dispatch(object):
def do_this(self): pass
def do_that(self): pass

def dispatch(self, cmd):
cmd = 'do_' + cmd
if hasattr(self, cmd):
getattr(self, cmd)()
else:
raise NotImplementedError

Just because functions are first-class in Python doesn't mean we have to use
them the way functional programmers use them. ;)
Think about it : As long as functions remain first class, some people
will program using a functional style (I surely intend to). The only
way to stop me from doing that is to remove functions from first class
status. If python ever gets very fast, people will reimplement things
like reduce in their own code or in a functional module.

Anyone is free to program in a functional manner. In fact, Guido was quite
amenable to the suggestion (I think by Hettinger) that there be a functional
module in the standard library, similar to how we have the itertools module
for generator fun.

However, we will remain free to point out how there's usually a more
straightforward Python idiom that does the same thing faster and more
clearly. ;) We all hope Python calls get fast enough that functional
programming in Python is not always slower, but, even if functional
constructs were faster than standard idiom, Python would still stick to
idiom, unless it needed to optimize.

Of the functional functions, the only one that can occasionally beat a
for-loop is map. Map is faster than anything else when the function used is
a builtin.

Remember that no matter how nice your lambda syntax gets, functional
programming will probably always be slow in Python, simply because calling
is slow in Python. Quite slow, in fact, and there's no obvious way around
that. So Python generally prefers solutions that do not involve calling
functions repeatedly, especially not functions as tiny as the ones you can
comfortably fit into a lambda. Given this, you can see why anonymous
functions don't make much sense for Python. Python would get rid of lambdas
before it tried to "make them better", and no one is sure what that would
entail. So just use 'def' and be happy.
Functions are supposedly first class, regular objects in python. Why
can't they be sometimes anonymous, just like tuples, lists and user
defined objects can ? One doesn't even need to consider other
languages to make this point.

They can be anonymous, but to be small enough to be anonymous means being
inefficient. Python simply does not go the way of small, throwaway
functions, because there's no obvious way to use them without morphing
Python into an entirely different "functional Python" language. And it will
still be slower than using for-loops.
Are there objects in python that must always have a name in any
context whatsoever ? It seems to me that all objects even modules can
be anonymous in at least some context.
Why are people even wondering about adding code blocks when making
real anonymous functions work will do ?

What does it mean to make them "work"? If you have an anonymous function,
where would you use it? map()? reduce()? But these are all slower and
less-intuitive to Pythonistas than using for-loops and list comprehensions.

So I would argue, there's no place to put anonymous functions to work in
Python. That's why they never do any. (Work, that is.)

If we make lambda some powerful construct that can have multi-line code,
we'd just scratch our heads and say, "why didn't you just use a def"? If
the function is long and involved enough, making it anonymous ceases to be
of any importance. We'd end up just assigning the lambda to a name anyway,
so what's the point?

In other words, why is:

def myname(): pass

somehow intrinsically worse than:

myname = lambda : pass

supposing the latter were legal? If lambda were in every way the same as
def, except that lambda is anonymous and def is not, and that lambda was
legal in more places, then certainly the lambda is more general than def,
and we should get rid of def, since Python does not like to have equivalent
constructs. But the only thing the latter has over the former is that the
latter can sometimes be used anonymously. "But," future Pythonistas will
say, "we hardly ever use these anonymously! Why don't we invent a new
syntax that allows us to define the name inline, like we see many other
languages happily doing." And then they reinvent def, and then the upstart
def-ites lobby Guido against the old-school lambda-ites, and lambda is
overthrown "because def," (speaking from the future, now), "replaces the
by-far-most common use case of lambda and does it more clearly, and the
little niche use of lambda that's left is so rare as to not be worth it
anyway. Guido Jr. the third, out."
I don't even get why some people who are against the anonymity of
lambdas seem quite ok with the anonymity of code blocks (given how
much more complex a code block can be compared to a lambda, how can
anonymity in their case be fine and not fine in the case of the much
simpler lambdas ?) .

It's not the anonymity. It just so happens that in Python, anonymity makes
no sense beyond very small functions placed into the call of these
functional functions for which we always have an equivalent for-loop or
list-comp construct that is faster and more Pythonic.

There simply aren't many places in Python where a function takes a function
as an argument. And those places where it does usually a for-loop is
clearer and faster (as I've been saying over and over). In other cases, the
function being passed is large enough that making it anonymous gains
nothing--you'd just have to use a name to refer to it anyway, in order to
make the code clear enough to read.

Or is:

map( lambda x:
<do some complex multi-line thing with x>
, range(10))

really clearer than just using def somewhere up above? It's not even clear
that anything like Python syntax could support such a construct, and in
anycase it is horribly unPythonic in its gnarish attempt to fit everything
into one construct. So, I could turn the tables and say "what's this
obsession with making things anonymous?" ;)

The only utility of an anonymous function is the ability to define a
function inline, within the calling construct, without polluting the
namespace. I.e., a "throwaway function". Now, how often in Python do all
those circumstance conjoin to make anonymous functions very useful? Not
very, especially because, as we said, function calling is slow in Python.
Does anyone care about consistency in python ? For real, if you don't
want functional programming, make functions non first class and stop
claiming that they are objects just like every object.

Umm...I don't understand. You can program functionally if you really want
to, but I don't see why Python should feel obligated to support your habit,
especially since it has its own way of doing things that is far more natural
(and, um, faster, at least now) to the Pythonic frame of mind. Pythonic is
a concept orthogonal to everything else, including "functional" and "OO".
Python doesn't define itself by saying "I am OO, not functional." Rather,
it examines itself, it peers into its own essence, and discovers, "hey,
there isn't much functional in here, but there's an awful lot of OO."
Python is something that simply *is*; definitions come later, and frankly
will always be inaccurate and provisional. "Pythonic" is like a culture;
undefinable and always evolving.

It's a tautology that a language best supports those who like the way that
language does things. So if you don't like the way Python does things, and
you prefer it did things in a more functional way, perhaps you would be
better supported by using a language that *did* do things in a more
functional way? It won't make you a bad (or even a lesser) person if you
don't use Python, but it might make you happier.

I mean really, fighting about languages is like fighting about the relative
moral worth of screwdrivers and hammers, and going from there to arguing
about whether it's better to use screws or nails.
 
J

Jarek Zgoda

Jp Calderone said:
A function must return to have a return value. When does sys.exit()
return?

Something, that is of type NoneType.

#v+.... print 'function'
.... 'None'
#v-

Anyway, isn't that function always returns value, even without explicit
"return" statement?
 
D

Dennis Lee Bieber

John Roth fed this fish to the penguins on Saturday 20 December 2003
13:13 pm:
languages.) It grew beyond there, but not by all that much.
Part of it's quirky charm is the way that it's i/o system faithfully
mirrored the old VM/CMS system.
That's the one feature the Amiga version did not duplicate <G>

Of course, since it was written to be a replacement for exec2, it
probably was quite tied to the base capabilities of IBM's OS. But in
that environment, REXX is essentially the equivalent of a shell script,
not a program running independent of a shell.

--
 
P

Peter Otten

Jarek said:
Anyway, isn't that function always returns value, even without explicit
"return" statement?
.... return 123
.... 2 0 LOAD_CONST 1 (123)
3 RETURN_VALUE
4 LOAD_CONST 0 (None)
7 RETURN_VALUE.... raise Exception
.... 2 0 LOAD_GLOBAL 0 (Exception)
3 RAISE_VARARGS 1
6 LOAD_CONST 0 (None)
9 RETURN_VALUE 1 0 LOAD_CONST 0 (None)
3 RETURN_VALUE
So Python always appends a

return None

statement at the end of a function.
Of course that doesn't mean that it will be executed.

Peter
 
J

John Roth

Bengt Richter said:
Nor can you supply explicit arguments if you want to, though you could
provide an alternate name, so you could access either way.

That's really an inherent feature of the 'property' notion:
since it's accessed like a variable, the getter can't have any
parameters. Since the property access return an object,
I suppose you could have something that looks like an
indexable or slicable property.
Nor can we do properties without accessing them via the attribute magic (i.e.,
not via bare global names for example).
I've floated various ideas/brain_farts more/less seriously for triggering magic
via name access alterantive to getattr magic, but there seems to be no enthusiasm
or else horrification at the thought, so I haven't stirred that pot for some time ;-)

What would be the syntax you would like to use, with what effect?

Well, the basic idea was simply to make the () optional for functions
with no parameters. No particular syntax there but it would require some
major jump through hoops gyrations from the virtual machine, and there
would have to be some way of getting the function object when you
wanted it, and I suspect the difference between a function object and
a more general 'callable' would totally confuse most people. And of
course, does a function/method with only keywords count as a function
with no parameters?

Ruby can get away with it because, as far as I know, functions are not
first class objects. They certainly aren't in Perl which was Ruby's
inspiration.

It's a non-starter for Python, though.

John Roth
 
J

John Roth

Skip Montanaro said:
John> The world changes, and ideas that seemed to be perfectly
John> appropriate five or ten years ago may no longer be such. Small
John> languages with a limited audience have a perfect right to be as
John> quirky or as "pure" as their authors want. Once they get beyond
John> that point, there's a bit of social responsibility involved in
John> addressing common problems.

So fork Python and show how it could be done better. If that's the case,
people will either drift over to Python-JR, or (some of) your ideas will
find their way back into Python-GvR.

I'm not likely to do that for two reasons. One is that, at this point in
my life, I'm not a C programmer. I don't even have a functional C
compiler on my machine. The other is that I don't particularly like
the notion of adding more and more options to the mix. I'm much
more concerned with the social issue of how software development
is done, and another variation on a good idea simply isn't my way
of approaching the issue.
Or, as in the Emacs/XEmacs split, darts may be thrown across the void for
the forseeable future. ;-)

John Roth
 
J

John Roth

Skip Montanaro said:
HV> I think no one even tries to understand the very concept of reducing
HV> sequence to a single object using a rule . Sum is not a replacement
HV> of this *concept*. Just what is so wrong with having such a general
HV> tool available in a programming language ? Doesn't it hurt to
HV> understand how to use it?

It doesn't hurt to understand the concept of reduce(), but if it's never (or
very rarely) used, it's just extra (nearly dead) code which has to be
maintained. It's easy enough to write reduce() in Python, and if/when PyPy
is a reality shouldn't be any less efficient than the current C version.

I'd have to agree that reduce, per se, isn't the world's most
useful function, and getting rid of marginally useful C code that
has to be maintained is a worthwhile objective.

It finally dawned on me last night that I could use the visitor
pattern for all cases of reduce, in a form that's probably
more understandable for the average programmer. And
if it isn't, then he's learned something more globally useful:
the visitor pattern.

That being the case, I'm going to withdraw whatever objections
I had to removing it from the language.

John Roth
 
J

John Roth

Dennis Lee Bieber said:
John Roth fed this fish to the penguins on Saturday 20 December 2003
13:13 pm:

That's the one feature the Amiga version did not duplicate <G>

Of course, since it was written to be a replacement for exec2, it
probably was quite tied to the base capabilities of IBM's OS. But in
that environment, REXX is essentially the equivalent of a shell script,
not a program running independent of a shell.

Actually, it wasn't written as a replacement for exec2. It was originally
written for VM/CMS, and Exec2 was an MVT/MVS facility.

John Roth
 
J

John Roth

Whoops! Forget my last response - you're
absolutely right. Exec2 was a CMS language,
I was thinking of Clist2

John Roth
 
A

Aahz

I'm not likely to do that for two reasons. One is that, at this point
in my life, I'm not a C programmer. I don't even have a functional C
compiler on my machine. The other is that I don't particularly like
the notion of adding more and more options to the mix. I'm much more
concerned with the social issue of how software development is done,
and another variation on a good idea simply isn't my way of approaching
the issue.

That's why ``import this`` is about the only good answer you'll get.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,144
Latest member
KetoBaseReviews
Top