Talin wrote:
The motivation, as I understand it, is one of mathematical consistency.
Noam told me in private email that this is *not* the motivation.
Instead, he wants mutable values. This, in turn, he wants so he
can catch modifications.
Regards,
Martin
Noam Raphael wrote:
2006/6/17, Martin v. Löwis [EMAIL PROTECTED]:
Noam Raphael wrote:
I meant the extra code for writing a special class to handle scalars,
if I decide that the x[()] syntax is too ugly or too hard to type,
so I write a special class which will allow the syntax x.value.
What
2006/6/18, Shane Hathaway [EMAIL PROTECTED]:
Try to think more about how users will use your API. You haven't
specified where those names (sheet1, income_tax, and profit) are coming
from. What do you expect users of your library to do to bring those
names into their namespace?
That's a good
On 6/17/06, Martin v. Löwis [EMAIL PROTECTED] wrote:
Talin wrote:
The motivation, as I understand it, is one of mathematical consistency.
Noam told me in private email that this is *not* the motivation.
Instead, he wants mutable values. This, in turn, he wants so he
can catch modifications.
On 6/18/06, Noam Raphael [EMAIL PROTECTED] wrote:
2006/6/18, Guido van Rossum [EMAIL PROTECTED]:
But more to the point, this discussion is pointless, since I won't
accept the syntax change.
OK, too bad!
But don't say I haven't warned you, when you will all use my fabulous
package and get
Talin [EMAIL PROTECTED] wrote:
Ok, so in order to clear up the confusion here, I am going to take a
moment to try and explain Noam's proposal in clearer language.
Now, as to the specifics of Noam's problem: Apparently what he is trying
to do is what many other people have done, which is
Hello,
2006/6/16, Josiah Carlson [EMAIL PROTECTED]:
I'm not a mathematician, and I don't really work with arrays of any
dimensionality, so the need for 0-D subscripting via arr[] while being
cute, isn't compelling to my uses for Python.
Thanks for appreciating its cuteness...
Now, I
Noam Raphael wrote:
I meant the extra code for writing a special class to handle scalars,
if I decide that the x[()] syntax is too ugly or too hard to type,
so I write a special class which will allow the syntax x.value.
What I cannot understand is why you use a zero-dimensional array to
2006/6/17, Martin v. Löwis [EMAIL PROTECTED]:
Noam Raphael wrote:
I meant the extra code for writing a special class to handle scalars,
if I decide that the x[()] syntax is too ugly or too hard to type,
so I write a special class which will allow the syntax x.value.
What I cannot
Hi, sorry for my repeated posts. I just wanted to say that I improved
my patch a little bit, so it does exactly the same thing, but with
smaller code: you can see for yourself at
http://python.pastebin.com/715221 - it changed exactly 10 lines of
code, and adds additional 8 lines, all of them
Martin v. Löwis wrote:
Noam Raphael wrote:
I meant the extra code for writing a special class to handle scalars,
if I decide that the x[()] syntax is too ugly or too hard to type,
so I write a special class which will allow the syntax x.value.
What I cannot understand is why you use a
On Sun, Jun 18, 2006, Noam Raphael wrote:
Hi, sorry for my repeated posts. I just wanted to say that I improved
my patch a little bit, so it does exactly the same thing, but with
smaller code: you can see for yourself at
http://python.pastebin.com/715221 - it changed exactly 10 lines of
But only if it makes sense. I still think there are some
severe conceptual difficulties with 0D arrays. One is
the question of how many items it contains. With 1 or
more dimensions, you can talk about its size along any
chosen dimension. But with 0 dimensions there's no size
to measure.
Hello,
It seems to me that people don't object to my proposal, but don't find
it useful to them either.
The question is, what to do next. I guess one possibility is to raise
this discussion again in a few months, when people will be less
occupied with 2.5 beta. This is ok, although I would
Noam Raphael [EMAIL PROTECTED] wrote:
2006/6/16, Gareth McCaughan [EMAIL PROTECTED]:
None of the above is intended to constitute argument for
or against Noam's proposed change to Python. Python isn't
primarily a language for mathematicians, and so much the
better for Python.
Thanks
BJörn Lindqvist wrote:
I don't know how difficult it is to get rid of the
implicit return None or even if it is doable, but if it is, it
should, IMHO, be done.
It's been proposed before, and the conclusion was that
it would cause more problems than it would solve.
(Essentially it would
Nick Coghlan wrote:
I think it more comes from the n-dimensional array approach - 'n=0' is
then a natural issue to consider.
But only if it makes sense. I still think there are some
severe conceptual difficulties with 0D arrays. One is
the question of how many items it contains. With 1 or
Greg Ewing wrote:
I'm having trouble seeing a real use for a 0D array as
something distinct from a scalar, as opposed to them
just being an oddity that happens to arise as a side
effect of the way Numeric/Numpy are implemented.
This has been rehashed over and over again on numpy-discussion.
On Sat, 10 Jun 2006, Greg Ewing wrote:
I'm having trouble seeing a real use for a 0D array as
something distinct from a scalar, as opposed to them
just being an oddity that happens to arise as a side
effect of the way Numeric/Numpy are implemented.
I think the whole discussion about the
Ka-Ping Yee wrote:
And from a syntax perspective, it's a bad idea. x[] is much
more often a typo than an intentional attempt to index a
zero-dimensional array.
but how often is it a typo?
for example, judging from c.l.python traffic, forgetting to add a return
statement is a quite common,
Ka-Ping Yee wrote:
I think the whole discussion about the concept and meaning of
zero-dimensional arrays is mostly irrelevant to the original
issue. The original issue is a *syntax* question: should
x[()] be written as x[]?
But, at least as presented in the PEP, it's a
syntax that was
Greg Ewing wrote:
Ka-Ping Yee wrote:
I think the whole discussion about the concept and meaning of
zero-dimensional arrays is mostly irrelevant to the original
issue. The original issue is a *syntax* question: should
x[()] be written as x[]?
But, at least as presented in the PEP, it's a
Hello,
I'll try to answer the questions in one message. Sorry for not being
able to do it until now.
About the joke - it isn't, I really need it.
About the timing - Of course, I can live with this getting into 2.6,
and I think that I may even be able to stay alive if this were
rejected. I still
Hello,
2006/6/10, Nick Coghlan [EMAIL PROTECTED]:
The closest parallel would be with return/yield, as those actually create real
tuples the same way subscripts do, and allow the expression to be omitted
entirely.
By that parallel, however, an implicit subscript (if adopted) should be None
And from a syntax perspective, it's a bad idea. x[] is much
more often a typo than an intentional attempt to index a
zero-dimensional array.
but how often is it a typo?
for example, judging from c.l.python traffic, forgetting to add a return
statement is a quite common, but I haven't
Noam Raphael wrote:
I hope that my (hopefully) better explanation made the use case more
compelling, but I want to add two points in favour of an empty tuple:
I guess I'm really only -0 on the idea of x[] invoking x.__getitem__(), and
allowing the class to decide whether or not to define a
Hello,
Recently I discovered that a small change to the Python grammar that
could help me a lot.
It's simply this: Currently, the expression x[] is a syntax error. I
suggest that it will be a valid syntax, and equivalent to x[()],
just as x[a, b] is equivalent to x[(a, b)] right now.
I
This is an elaborate joke, right?
On 6/9/06, Noam Raphael [EMAIL PROTECTED] wrote:
Hello,
Recently I discovered that a small change to the Python grammar that
could help me a lot.
It's simply this: Currently, the expression x[] is a syntax error. I
suggest that it will be a valid syntax,
On 6/9/06, Nicko van Someren [EMAIL PROTECTED] wrote:
On 9 Jun 2006, at 17:44, Guido van Rossum wrote:
This is an elaborate joke, right?
On 6/9/06, Noam Raphael [EMAIL PROTECTED] wrote:
...
It's simply this: Currently, the expression x[] is a syntax
error. I
suggest that it will be
Guido van Rossum wrote:
On 6/9/06, Nicko van Someren [EMAIL PROTECTED] wrote:
[...]
The language doesn't have zero-dimensional arrays, although it doesn't
prevent users from defining them. but why would one want to index a
zero-dimensional array, since it has no dimensions? It should be
Noam Raphael wrote:
This PEP suggests to allow the use of an empty subscript list, for
example ``x[]``, which is currently a syntax error. It is suggested
that in such a case, an empty tuple will be passed as an argument to
the __getitem__ and __setitem__ methods. This is consistent with the
Alex Martelli wrote:
Well, x=23 on one side, and x[]=23 aka x[()]=23 on the other, have
drastically different semantics. Indexing refers to the contents of
the zero-dimensional container, rather than to a name to which the
container happens to be bound (but isn't any more, once one assigns
Tim Hochberg wrote:
In Numpy, a 0-D array [for example, array(5)] is almost, but not quite,
equivalent to scalar [for example, 5]. The difference is that the
former is mutable.
Hmmm, I hadn't considered that. I suppose this is
something that arises from NumPy's view semantics
of indexing
Greg Ewing wrote:
Tim Hochberg wrote:
In Numpy, a 0-D array [for example, array(5)] is almost, but not quite,
equivalent to scalar [for example, 5]. The difference is that the
former is mutable.
Hmmm, I hadn't considered that. I suppose this is
something that arises from NumPy's view
Alex Martelli wrote:
On Jun 9, 2006, at 4:55 PM, Greg Ewing wrote:
...
Think about how you get from an N dimensional array to
an N-1 dimensional array: you index it, e.g.
A2 = [[1, 2], [3, 4]] # a 2D array
A1 = A2[1] # a 1D array
A0 = A1[1] # a 0D array???
print A0
What do you
35 matches
Mail list logo