On Sun, 16 Aug 2009 05:05:01 +, Steven D'Aprano wrote:
> Now that I understand what the semantics of cout << "Hello world" are, I
> don't have any problem with it either. It is a bit weird, "Hello world"
> >> cout would probably be better,
Placing the stream on the LHS allows the main forms
On Aug 16, 6:18 am, Steven D'Aprano wrote:
> On Sun, 16 Aug 2009 01:41:41 -0700, Douglas Alan wrote:
> > I would definitely not like a language that obscures assignment by
> > moving it over to the right side of lines.
> One could argue that left-assigned-from-right assignment obscures the
> mo
On Aug 16, 8:45 am, MRAB wrote:
> No, APL is strictly right-to-left.
>
> -> x
>
> means "goto x".
>
> Writing to the console is:
>
> [] <- myVar
>
> Reading from the console is:
>
> myVar <- []
Ah, thanks for the correction. It's been 5,000 years since I used APL!
|>ouglas
--
ht
Douglas Alan wrote:
[snip]
C++ also allows for reading from stdin like so:
cin >> myVar;
I think the direction of the arrows probably derives from languages
like APL, which had notation something like so:
myVar <- 3
[] <- myVar
"<-" was really a little arrow symbol (APL didn't us
On Sunday 16 August 2009 12:18:11 Steven D'Aprano wrote:
> In any case, after half a century of left-from-right assignment, I think
> it's worth the experiment in a teaching language or three to try it the
> other way. The closest to this I know of is the family of languages
> derived from Apple's
On Sun, 16 Aug 2009 01:41:41 -0700, Douglas Alan wrote:
> I like to be able to read everything from left to right, and Lisp does
> that more than any other programming language.
>
> I would definitely not like a language that obscures assignment by
> moving it over to the right side of lines.
On
On Aug 16, 4:48 am, Erik Max Francis wrote:
> Douglas Alan wrote:
> > Personally, my favorite is Lisp, which looks like
>
> > (set! y (+ y 1))
>
> For varying values of "Lisp." `set!` is Scheme.
Yes, I'm well aware!
There are probably as many different dialects of Lisp as all other
programmi
Douglas Alan wrote:
Personally, my favorite is Lisp, which looks like
(set! y (+ y 1))
For varying values of "Lisp." `set!` is Scheme.
--
Erik Max Francis && m...@alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 18 N 121 57 W && AIM/Y!M/Skype erikmaxfrancis
Get there
Steven D'Aprano wrote:
I don't like normal assignment. After nearly four decades of mathematics
and programming, I'm used to it, but I don't think it is especially good.
It confuses beginners to programming: they get one set of behaviour
drilled into them in maths class, and then in programming
On Aug 16, 4:22 am, Steven D'Aprano wrote:
> I don't like normal assignment. After nearly four decades of mathematics
> and programming, I'm used to it, but I don't think it is especially good.
> It confuses beginners to programming: they get one set of behaviour
> drilled into them in maths clas
On Sun, 16 Aug 2009 09:24:36 +0200, Hendrik van Rooyen wrote:
>>"Steven D'Aprano" wrote:
>
>>Now that I understand what the semantics of cout << "Hello world" are, I
>>don't have any problem with it either. It is a bit weird, "Hello world"
cout would probably be better, but it's hardly the
>"Steven D'Aprano" wrote:
>Now that I understand what the semantics of cout << "Hello world" are, I
>don't have any problem with it either. It is a bit weird, "Hello world"
>>> cout would probably be better, but it's hardly the strangest design in
>any programming language, and it's probably
On Aug 16, 1:05 am, Steven D'Aprano wrote:
> On Sat, 15 Aug 2009 20:00:23 -0700, Douglas Alan wrote:
> > So, as far as I can tell, Python has no real authority to throw stones
> > at C++ on this little tiny particular issue.
> I think you're being a tad over-defensive.
Defensive? Personally, I p
On Sat, 15 Aug 2009 20:00:23 -0700, Douglas Alan wrote:
> So, as far as I can tell, Python has no real authority to throw stones
> at C++ on this little tiny particular issue.
I think you're being a tad over-defensive. I asked a genuine question
about a quote in somebody's signature. That's a qu
On Aug 15, 10:19 pm, Steven D'Aprano wrote:
> On Sat, 15 Aug 2009 13:01:43 -0700, Douglas Alan wrote:
> > P.S. I find it strange, however, that anyone who is not okay with
> > "abusing" operator overloading in this manner, wouldn't also take
> > umbrage at Python's overloading of "+" to work with
On Sat, 15 Aug 2009 13:01:43 -0700, Douglas Alan wrote:
> P.S. I find it strange, however, that anyone who is not okay with
> "abusing" operator overloading in this manner, wouldn't also take
> umbrage at Python's overloading of "+" to work with strings and lists,
> etc. Numerical addition and seq
On Aug 14, 1:55 pm, Steven D'Aprano wrote:
> Douglas, you and I clearly have a difference of opinion on
> this. Neither of us have provided even the tiniest amount
> of objective, replicable, reliable data on the
> error-proneness of the C++ approach versus that of
> Python. The supposed superior
I guess the problem is---does it actually matter?
On Fri, Aug 14, 2009 at 10:11 AM, Steven D'Aprano <
st...@remove-this-cybersource.com.au> wrote:
> On Fri, 14 Aug 2009 07:07:31 -0700, Aahz wrote:
>
> > "I saw `cout' being shifted "Hello world" times to the left and stopped
> > right there." --S
On Aug 14, 10:25 pm, Dave Angel wrote:
> Benjamin Kaplan wrote:
> > On Fri, Aug 14, 2009 at 12:42 PM, Douglas Alan wrote:
> >> P.S. Overloading "left shift" to mean "output" does indeed seem a bit
> >> sketchy, but in 15 years of C++ programming, I've never seen it cause
> >> any confusion or b
On Sat, Aug 15, 2009 at 4:47 AM, Hendrik van
Rooyen wrote:
> On Friday 14 August 2009 18:11:52 Steven D'Aprano wrote:
>> On Fri, 14 Aug 2009 07:07:31 -0700, Aahz wrote:
>> > "I saw `cout' being shifted "Hello world" times to the left and stopped
>> > right there." --Steve Gonedes
>>
>> Assuming th
On Friday 14 August 2009 18:11:52 Steven D'Aprano wrote:
> On Fri, 14 Aug 2009 07:07:31 -0700, Aahz wrote:
> > "I saw `cout' being shifted "Hello world" times to the left and stopped
> > right there." --Steve Gonedes
>
> Assuming that's something real, and not invented for humour, I presume
> that
Benjamin Kaplan wrote:
On Fri, Aug 14, 2009 at 12:42 PM, Douglas Alan wrote:
P.S. Overloading "left shift" to mean "output" does indeed seem a bit
sketchy, but in 15 years of C++ programming, I've never seen it cause
any confusion or bugs.
The only reason it hasn't is because people
On Fri, Aug 14, 2009 at 12:42 PM, Douglas Alan wrote:
>
> P.S. Overloading "left shift" to mean "output" does indeed seem a bit
> sketchy, but in 15 years of C++ programming, I've never seen it cause
> any confusion or bugs.
The only reason it hasn't is because people use it in "Hello World". I
Grant Edwards wrote:
On 2009-08-14, Erik Max Francis wrote:
Grant Edwards wrote:
On 2009-08-14, Steven D'Aprano wrote:
What the hell
would it actually do???
IIRC in C++,
cout << "Hello world";
is equivalent to this in C:
printf("Hellow world");
or this in Python:
print "hello
On 2009-08-14, Erik Max Francis wrote:
> Grant Edwards wrote:
>> On 2009-08-14, Steven D'Aprano wrote:
>>> What the hell
>>> would it actually do???
>>
>> IIRC in C++,
>>
>>cout << "Hello world";
>>
>> is equivalent to this in C:
>>
>>printf("Hellow world");
>>
>> or this in Python:
Grant Edwards wrote:
On 2009-08-14, Steven D'Aprano wrote:
What the hell
would it actually do???
IIRC in C++,
cout << "Hello world";
is equivalent to this in C:
printf("Hellow world");
or this in Python:
print "hellow world"
Well, plus or minus newlines.
--
Erik Max Francis
I think I've spent enough time on this discussion, so I won't be directly
responding to any of your recent points -- it's clear that I'm not
persuading you that there's any justification for any behaviour for
escape sequences other than the way C++ deals with them. That's your
prerogative, of c
On Aug 14, 12:17 pm, Grant Edwards wrote:
> On 2009-08-14, Steven D'Aprano wrote:
> > On Fri, 14 Aug 2009 07:07:31 -0700, Aahz wrote:
> >> "I saw `cout' being shifted "Hello world" times to the left and stopped
> >> right there." --Steve Gonedes
>
> > Assuming that's something real, and not i
Grant Edwards wrote:
On 2009-08-14, Steven D'Aprano wrote:
On Fri, 14 Aug 2009 07:07:31 -0700, Aahz wrote:
"I saw `cout' being shifted "Hello world" times to the left and stopped
right there." --Steve Gonedes
Assuming that's something real, and not invented for humour, I presume
that's desc
On 2009-08-14, Steven D'Aprano wrote:
> On Fri, 14 Aug 2009 07:07:31 -0700, Aahz wrote:
>
>> "I saw `cout' being shifted "Hello world" times to the left and stopped
>> right there." --Steve Gonedes
>
> Assuming that's something real, and not invented for humour, I presume
> that's describing som
On Fri, 14 Aug 2009 07:07:31 -0700, Aahz wrote:
> "I saw `cout' being shifted "Hello world" times to the left and stopped
> right there." --Steve Gonedes
Assuming that's something real, and not invented for humour, I presume
that's describing something possible in C++. Am I correct? What the he
In article <6e13754c-1fa6-4d1b-8861-146bffec8...@h30g2000vbr.googlegroups.com>,
Douglas Alan wrote:
>
>My friend begs to differ with the above. It would be much better for
>debugging if Python generated a parsing error for unrecognized escape
>sequences, rather than leaving them unchanged. g++ ou
On Aug 12, 7:19 pm, Steven D'Aprano wrote:
> You are making an unjustified assumption: \y is not an error.
You are making in an unjustified assumption that I ever made such an
assumption!
My claim is and has always been NOT that \y is inately an error, but
rather that treating unrecognized esca
Steven D'Aprano wrote:
On Wed, 12 Aug 2009 14:21:34 -0700, Douglas Alan wrote:
On Aug 12, 5:32 am, Steven D'Aprano
wrote:
That problem basically boils down to a deep-seated philosophical
disagreement over which philosophy a language should follow in regard
to backslash escapes:
"Anything no
On Wed, 12 Aug 2009 14:21:34 -0700, Douglas Alan wrote:
> On Aug 12, 5:32 am, Steven D'Aprano
> wrote:
>
>> That problem basically boils down to a deep-seated philosophical
>> disagreement over which philosophy a language should follow in regard
>> to backslash escapes:
>>
>> "Anything not expli
On Aug 12, 5:32 am, Steven D'Aprano
wrote:
> That problem basically boils down to a deep-seated
> philosophical disagreement over which philosophy a
> language should follow in regard to backslash escapes:
>
> "Anything not explicitly permitted is forbidden"
>
> versus
>
> "Anything not explicitl
On Aug 12, 3:36 am, Steven D'Aprano
wrote:
> On Tue, 11 Aug 2009 13:20:52 -0700, Douglas Alan wrote:
> > My "Annotated C++ Reference Manual" is packed, and surprisingly in
> > Stroustrup's Third Edition, there is no mention of the issue in the
> > entire 1,000 pages. But Microsoft to the rescue:
On Aug 12, 3:08 am, Steven D'Aprano
wrote:
> On Tue, 11 Aug 2009 14:48:24 -0700, Douglas Alan wrote:
> > In any case, my argument has consistently been that Python should have
> > treated undefined escape sequences consistently as fatal errors,
>
> A reasonable position to take. I disagree with i
On Tue, 11 Aug 2009 14:29:43 -0700, Douglas Alan wrote:
> I need to preface this entire post with the fact that I've already used
> ALL of the arguments that you've provided on my friend before I ever
> even came here with the topic, and my own arguments on why Python can be
> considered to be doi
On Tue, 11 Aug 2009 13:20:52 -0700, Douglas Alan wrote:
> On Aug 11, 2:00 pm, Steven D'Aprano cybersource.com.au> wrote:
>
>> > test.cpp:1:1: warning: unknown escape sequence '\y'
>>
>> Isn't that a warning, not a fatal error? So what does temp contain?
>
> My "Annotated C++ Reference Manual" i
On Tue, 11 Aug 2009 14:48:24 -0700, Douglas Alan wrote:
> In any case, my argument has consistently been that Python should have
> treated undefined escape sequences consistently as fatal errors,
A reasonable position to take. I disagree with it, but it is certainly
reasonable.
> not as warni
I wrote:
> But you're right, it's too late to change this now.
P.S. But if it weren't too late, I think that your idea to have "\s"
be the escape sequence for a backslash instead of "\\" might be a good
one.
|>ouglas
--
http://mail.python.org/mailman/listinfo/python-list
On Aug 11, 4:38 pm, Ethan Furman wrote:
> Mind you, I'm not really vested in how Python *should* handle
> backslashes one way or the other, but I am glad it has rules that it
> follows for consitent results, and I don't have to break out a byte-code
> editor to find out what's in my string litera
On Aug 10, 11:27 pm, Steven D'Aprano
wrote:
> On Mon, 10 Aug 2009 08:21:03 -0700, Douglas Alan wrote:
> > But you're right, it's too late to change this now.
>
> Not really. There is a procedure for making non-backwards compatible
> changes. If you care deeply enough about this, you could agitate
Steven D'Aprano wrote:
> Because the cost isn't zero. Needing to write \\ in a string
> literal when you want \ is a cost,
I need to preface this entire post with the fact that I've
already used ALL of the arguments that you've provided on my
friend before I ever even came here with the topic, an
Douglas Alan wrote:
On Aug 11, 2:00 pm, Steven D'Aprano wrote:
test.cpp:1:1: warning: unknown escape sequence '\y'
Isn't that a warning, not a fatal error? So what does temp contain?
My "Annotated C++ Reference Manual" is packed, and surprisingly in
Stroustrup's Third Edition, there is n
On Aug 11, 2:00 pm, Steven D'Aprano wrote:
> > test.cpp:1:1: warning: unknown escape sequence '\y'
>
> Isn't that a warning, not a fatal error? So what does temp contain?
My "Annotated C++ Reference Manual" is packed, and surprisingly in
Stroustrup's Third Edition, there is no mention of the iss
On Tue, 11 Aug 2009 15:50:01 +0200, Piet van Oostrum wrote:
>> Steven D'Aprano (SD) wrote:
>
>>SD> If I'm reading this page correctly, Python does behave as C++ does.
>>Or at SD> least as Larch/C++ does:
>
>>SD> http://www.cs.ucf.edu/~leavens/larchc++manual/lcpp_47.html
>
> They call them
Steven D'Aprano wrote:
On Mon, 10 Aug 2009 08:21:03 -0700, Douglas Alan wrote:
But you're right, it's too late to change this now.
Not really. There is a procedure for making non-backwards compatible
changes. If you care deeply enough about this, you could agitate for
Python 3.2 to raise
> Steven D'Aprano (SD) wrote:
>SD> If I'm reading this page correctly, Python does behave as C++ does. Or at
>SD> least as Larch/C++ does:
>SD> http://www.cs.ucf.edu/~leavens/larchc++manual/lcpp_47.html
They call them `non-standard escape sequences' for a reason: that they
are not in stand
On Mon, 10 Aug 2009 15:17:24 -0700, Douglas Alan wrote:
> From: Steven D'Aprano wrote:
>
>> On Mon, 10 Aug 2009 00:32:30 -0700, Douglas Alan wrote:
>
>> > In C++, if I know that the code I'm looking at compiles, then I never
>> > need worry that I've misinterpreted what a string literal means.
On Mon, 10 Aug 2009 08:21:03 -0700, Douglas Alan wrote:
> But you're right, it's too late to change this now.
Not really. There is a procedure for making non-backwards compatible
changes. If you care deeply enough about this, you could agitate for
Python 3.2 to raise a PendingDepreciation warni
From: Steven D'Aprano wrote:
> On Mon, 10 Aug 2009 00:32:30 -0700, Douglas Alan wrote:
> > In C++, if I know that the code I'm looking at compiles,
> > then I never need worry that I've misinterpreted what a
> > string literal means.
> If you don't know what your string literals are, you don't
On Aug 10, 1:37 am, Steven D'Aprano
wrote:
> On Mon, 10 Aug 2009 00:37:33 -0700, Carl Banks wrote:
> > On Aug 9, 11:10 pm, Steven D'Aprano
> > wrote:
> >> On Sun, 09 Aug 2009 18:34:14 -0700, Carl Banks wrote:
> >> >> Why should a backslash in a string literal be an error?
>
> >> > Because the beh
On Aug 10, 4:41 am, MRAB wrote:
> Steven D'Aprano wrote:
> > On Sun, 09 Aug 2009 17:56:55 -0700, Douglas Alan wrote:
>
> [snip]
> >> My point of view is that
> >> every language has *some* warts; Python just has a bit fewer than most.
> >> It would have been nice, I should think, if this wart had
On Aug 10, 10:58 am, Scott David Daniels
wrote:
> The string rules reflect C's rules, and I see little
> excuse for trying to change them now.
No they don't. Or at least not C++'s rules. C++ behaves exactly as I
should like.
(Or at least g++ does. Or rather *almost* as I would like, as by
defau
Douglas Alan wrote:
So, what's the one obvious right way to express "foo\zbar"? Is it
"foo\zbar"
or
"foo\\zbar"
And if it's the latter, what possible benefit is there in allowing the
former? And if it's the former, why does Python echo the latter?
Actually, if we were designing from fres
On Aug 10, 4:37 am, Steven D'Aprano
> There is at least one good reason for preferring an error, namely that it
> allows Python to introduce new escape codes without going through a long,
> slow process. But the rest of these complaints are terribly unconvincing.
What about:
o Beautiful is b
Steven D'Aprano wrote:
On Sun, 09 Aug 2009 17:56:55 -0700, Douglas Alan wrote:
[snip]
My point of view is that
every language has *some* warts; Python just has a bit fewer than most.
It would have been nice, I should think, if this wart had been "fixed"
in Python 3, as I do consider it to be a
Steven D'Aprano wrote:
> Or perhaps they should follow bash's lead, and map \C to C for every
> character. If there were no special escapes at all, Windows
> programmers wouldn't keep getting burnt when they write
> "C:\\Documents\today\foo" and end up with something completely
> unexpected.
>
On Mon, 10 Aug 2009 00:32:30 -0700, Douglas Alan wrote:
> In C++, if I know that the code I'm looking at compiles, then I never
> need worry that I've misinterpreted what a string literal means.
If you don't know what your string literals are, you don't know what your
program does. You can't exp
Douglas Alan wrote:
> "\xba" isn't an escape sequence in any other language that I've used,
> which is one reason I made this error... Oh, wait a minute -- it *is*
> an escape sequence in JavaScript. But in JavaScript, while "\xba" is a
> special character, "\xb" is synonymous with "xb".
>
"\xb
On Mon, 10 Aug 2009 00:57:18 -0700, Douglas Alan wrote:
> On Aug 10, 2:10 am, Steven D'Aprano
>
>> I've never had any errors caused by this.
>
> But you've seen an error caused by this, in this very discussion. I.e.,
> "foo\xbar".
Your complaint is that "invalid" escapes like \y resolve to a l
On Mon, 10 Aug 2009 00:37:33 -0700, Carl Banks wrote:
> On Aug 9, 11:10 pm, Steven D'Aprano
> wrote:
>> On Sun, 09 Aug 2009 18:34:14 -0700, Carl Banks wrote:
>> >> Why should a backslash in a string literal be an error?
>>
>> > Because the behavior of \ in a string is context-dependent, which
>>
On Aug 10, 2:10 am, Steven D'Aprano
> I've never had any errors caused by this.
But you've seen an error caused by this, in this very discussion.
I.e., "foo\xbar".
"\xba" isn't an escape sequence in any other language that I've used,
which is one reason I made this error... Oh, wait a minute --
On Aug 9, 11:10 pm, Steven D'Aprano
wrote:
> On Sun, 09 Aug 2009 18:34:14 -0700, Carl Banks wrote:
> >> Why should a backslash in a string literal be an error?
>
> > Because the behavior of \ in a string is context-dependent, which means
> > a reader can't know if \ is a literal character or escap
On Aug 10, 2:03 am, Steven D'Aprano
wrote:
> On Sun, 09 Aug 2009 17:56:55 -0700, Douglas Alan wrote:
> > Because in Python, if my friend sees the string "foo\xbar\n", he has no
> > idea whether the "\x" is an escape sequence, or if it is just the
> > characters "\x", unless he looks it up in the
On Sun, 09 Aug 2009 23:03:14 -0700, John Nagle wrote:
> if another escape character ever has to be
> added to the language, that may change the semantics of previously
> correct strings.
And that's the only argument in favour of prohibiting non-special
backslash sequences I've seen yet that is e
On Sun, 09 Aug 2009 18:34:14 -0700, Carl Banks wrote:
>> Why should a backslash in a string literal be an error?
>
> Because the behavior of \ in a string is context-dependent, which means
> a reader can't know if \ is a literal character or escape character
> without knowing the context, and it
On Sun, 09 Aug 2009 17:56:55 -0700, Douglas Alan wrote:
> Steven D'Aprano wrote:
>
>> Why should a backslash in a string literal be an error?
>
> Because in Python, if my friend sees the string "foo\xbar\n", he has no
> idea whether the "\x" is an escape sequence, or if it is just the
> characte
Carl Banks wrote:
IOW it's an error-prone mess. It would be better if Python (like C)
treated \ consistently as an escape character. (And in raw strings,
consistently as a literal.)
Agreed. For one thing, if another escape character ever has to be
added to the language, that may change th
On Aug 9, 8:06 pm, Steven D'Aprano wrote:
> while the behaviour your
> friend wants is "treat a backslash as an error, except for these
> exceptions".
Besides, can't all error situations be described as, "treat the error
situation as an error, except for the exception of when the situation
isn't
On Aug 9, 5:06 pm, Steven D'Aprano wrote:
> On Sun, 09 Aug 2009 12:26:54 -0700, Douglas Alan wrote:
> > A friend of mine is just learning Python, and he's a bit tweaked about
> > how unrecognized escape sequences are treated in Python.
> ...
> > In any case, I think my friend should mellow out a b
Steven D'Aprano wrote:
> Why should a backslash in a string literal be an error?
Because in Python, if my friend sees the string "foo\xbar\n", he has
no idea whether the "\x" is an escape sequence, or if it is just the
characters "\x", unless he looks it up in the manual, or tries it out
in the R
On Sun, 09 Aug 2009 12:26:54 -0700, Douglas Alan wrote:
> A friend of mine is just learning Python, and he's a bit tweaked about
> how unrecognized escape sequences are treated in Python.
...
> In any case, I think my friend should mellow out a bit, but we both
> consider this something of a wart.
A friend of mine is just learning Python, and he's a bit tweaked about
how unrecognized escape sequences are treated in Python. This is from
the Python 3.0 reference manual:
Unlike Standard C, all unrecognized escape sequences are left in
the string unchanged, i.e.,
the backslash is left
76 matches
Mail list logo