Steven D'Aprano wrote:
I don't know what the state of the art on Mac is
these days, but in 1984s Macs had a standard keyboard layout that let you
enter most available characters via the keyboard, using sensible
mnemonics. E.g. on a US keyboard layout, you could get ≠ by holding down
the
On Nov 19, 12:20 am, Gregory Ewing greg.ew...@canterbury.ac.nz
wrote:
Steven D'Aprano wrote:
I don't know what the state of the art on Mac is
these days, but in 1984s Macs had a standard keyboard layout that let you
enter most available characters via the keyboard, using sensible
Carl Banks pavlovevide...@gmail.com writes:
On Nov 19, 12:20 am, Gregory Ewing greg.ew...@canterbury.ac.nz
wrote:
They all still seem to work -- presumably generating the appropriate
unicode characters now instead of MacRoman.
³It¹s about time.²
I � Unicode.
(lrf, gung *vf* qryvorengr,
On Wed, 18 Nov 2009 18:28:11 +1300, greg wrote:
r wrote:
I think the syntax was chosen because the alternatives are even worse
AND since assignment is SO common in programming, would you *really*
rather type two chars instead of one?
Smalltalk solved the problem by using a left-arrow
On Nov 18, 5:27 pm, Steven D'Aprano
ste...@remove.this.cybersource.com.au wrote:
On Wed, 18 Nov 2009 18:28:11 +1300, greg wrote:
r wrote:
I think the syntax was chosen because the alternatives are even worse
AND since assignment is SO common in programming, would you *really*
rather type
On Thu, 12 Nov 2009 21:27:31 +0100, Bruno Desthuilliers wrote:
Congratulations, you just reinvented one of the most infamous source of
bugs in C, C++, Java, PHP, javascript and quite a few other languages.
Believe it or not, but not allowing this in Python was a very deliberate
design choice.
Jonathan Saxton wrote:
On Thu, 12 Nov 2009 21:27:31 +0100, Bruno Desthuilliers wrote:
Congratulations, you just reinvented one of the most infamous
source of bugs in C, C++, Java, PHP, javascript and quite a few
other languages. Believe it or not, but not allowing this in
Python was a very
On Nov 17, 9:28 am, Jonathan Saxton jsax...@appsecinc.com wrote:
And if I ever find the genius who had the brilliant idea of using = to mean
assignment then I have a particularly nasty dungeon reserved just for him.
Also a foul-smelling leech-infested swamp for those language designers and
On Tue, 17 Nov 2009 17:31:18 +, MRAB wrote:
And if I ever find the genius who had the brilliant idea of using =
to mean assignment then I have a particularly nasty dungeon reserved
just for him. Also a foul-smelling leech-infested swamp for those
language designers and compiler writers
On Nov 17, 7:28 am, Jonathan Saxton jsax...@appsecinc.com wrote:
On Thu, 12 Nov 2009 21:27:31 +0100, Bruno Desthuilliers wrote:
Congratulations, you just reinvented one of the most infamous source of
bugs in C, C++, Java, PHP, javascript and quite a few other languages.
Believe it or not,
MRAB wrote:
Fortran uses = and .EQ., probably because (some) earlier autocodes
did.
I think Fortran used .LT. and .GT. because some early character
sets didn't have and symbols. Having done that, it
probably seemed more consistent to use .EQ. for comparison
than to break the pattern and use
r wrote:
I think the syntax was chosen because the
alternatives are even worse AND since assignment is SO common in
programming, would you *really* rather type two chars instead of one?
Smalltalk solved the problem by using a left-arrow character
for assignment. But they had an unfair
r a écrit :
On Nov 12, 7:44 pm, Steven D'Aprano st...@remove-this-
cybersource.com.au wrote
Oh, but those hundreds of thousands of man-hours lost to bugs caused by
assignment-as-an-expression is nothing compared to the dozens of man-
minutes saved by having one fewer line of code!
OK, what
r a écrit :
On Nov 12, 2:37 pm, Bruno Desthuilliers
bdesth.quelquech...@free.quelquepart.fr wrote:
Oh i get it now! If i assign a valid value to a variable the variable
is also valid...thats...thats... GENUIS! *sarcasm*
It's not about assigning a valid value to a variable, it's about the
On Nov 13, 3:20 pm, Bruno Desthuilliers
bdesth.quelquech...@free.quelquepart.fr wrote:
(...snip...)
I think because (like me) Carl
put's the language before sewing circles. I think it's just personal
like all the times before,
Well, to be true, you did manage to make a clown of yourself
On Wed, 11 Nov 2009 03:52:45 -0800, Carl Banks wrote:
This is where a helper function is good. You want a dispatcher:
No I really don't. I want to be able to see the action performed
adjacent to the test, and not have to scroll up to down ten pages to
find whatever function it dispatched
r a écrit :
-snip)
Just thinking out loud here...what if variable assignments could
return a value... hmmm? Not to them selfs of course but to a caller,
like an if statement...
if a=openfile:
# do something with a
Congratulations, you just reinvented one of the most infamous source of
Steven D'Aprano a écrit :
(snip)
Hint to would-be language designers: if you start off by claiming that a
new feature will save an indent level, when in fact it *doesn't* save an
indent level, you can save yourself from embarrassment by pressing Close
on your post instead of Send.
r a écrit :
On Nov 11, 2:37 am, Steven D'Aprano
ste...@remove.this.cybersource.com.au wrote:
On Wed, 11 Nov 2009 00:08:58 -0800, r wrote:
Yea it's called a NameError. Would it not also blow up in the current
state of syntax usage?
No.
if var:
print 'var'
Traceback (most recent call
On Nov 12, 2:37 pm, Bruno Desthuilliers
bdesth.quelquech...@free.quelquepart.fr wrote:
Oh i get it now! If i assign a valid value to a variable the variable
is also valid...thats...thats... GENUIS! *sarcasm*
It's not about assigning a valid value to a variable, it's about the
name being
On Thu, 12 Nov 2009 21:27:31 +0100, Bruno Desthuilliers wrote:
Congratulations, you just reinvented one of the most infamous source of
bugs in C, C++, Java, PHP, javascript and quite a few other languages.
Believe it or not, but not allowing this in Python was a very deliberate
design choice.
On Nov 12, 7:44 pm, Steven D'Aprano st...@remove-this-
cybersource.com.au wrote
Oh, but those hundreds of thousands of man-hours lost to bugs caused by
assignment-as-an-expression is nothing compared to the dozens of man-
minutes saved by having one fewer line of code!
OK, what *if* the
On Thu, Nov 12, 2009 at 8:10 PM, r rt8...@gmail.com wrote:
On Nov 12, 7:44 pm, Steven D'Aprano st...@remove-this-
cybersource.com.au wrote
Oh, but those hundreds of thousands of man-hours lost to bugs caused by
assignment-as-an-expression is nothing compared to the dozens of man-
minutes
On Nov 11, 1:25 am, Steven D'Aprano
ste...@remove.this.cybersource.com.au wrote:
(snip)
Incorrect.
True == None
False
False == None
False
Of course i meant True/False but my fingers were thinking None at the
time. And besides if i don't make a mistake here or there what ever
would you do
On Wed, 11 Nov 2009 00:08:58 -0800, r wrote:
#variable var will never be created!
That will cause no end of trouble.
if range(N) as var:
do_something_with_var()
if var:
print Oops, this blows up if N = 0
Conditional assignments are a terrible idea.
Yea it's called a
On Nov 11, 2:37 am, Steven D'Aprano
ste...@remove.this.cybersource.com.au wrote:
On Wed, 11 Nov 2009 00:08:58 -0800, r wrote:
Yea it's called a NameError. Would it not also blow up in the current
state of syntax usage?
No.
if var:
print 'var'
Traceback (most recent call last):
On Nov 10, 9:37 pm, Steven D'Aprano
ste...@remove.this.cybersource.com.au wrote:
On Tue, 10 Nov 2009 20:13:21 -0800, Carl Banks wrote:
On Nov 10, 7:12 pm, Steven D'Aprano
ste...@remove.this.cybersource.com.au wrote:
On Tue, 10 Nov 2009 12:45:13 -0800, Bearophile wrote:
r:
i think the
On Nov 10, 9:44 pm, Terry Reedy tjre...@udel.edu wrote:
Carl Banks wrote:
r didn't actually give a good example. Here is case where it's
actually useful. (Pretend the regexps are too complicated to be
parsed with string method.)
if re.match(r'go\s+(north|south|east|west)',cmd) as m:
Hi,
On 11/11/2009 12:30 PM, r wrote:
[...snip...]
I think what has escaped everyone (including myself until my second
post) is the fact that what really needs to happen is for variable
*assignments* to return a boolean to any statements that evaluate
the assignment -- like in an if or elif
On Nov 10, 1:23 pm, r rt8...@gmail.com wrote:
Forgive me if i don't properly explain the problem but i think the
following syntax would be quite beneficial to replace some redundant
if's in python code.
if something_that_returns_value() as value:
#do something with value
# Which can
r wrote:
Just thinking out loud here...what if variable assignments could
return a value... hmmm? Not to them selfs of course but to a caller,
like an if statement...
if a=openfile:
# do something with a
That's like in C. I sometimes miss it in Python.
robert
--
Steven D'Aprano wrote:
Why is the third example, with an if... test, so special that it needs
special syntax to make it a two-liner?
...because Beautiful is better than ugly.
I can quote the Zen too:
Special cases aren't special enough to break the rules.
You haven't demonstrated that your
On Wed, 11 Nov 2009 04:00:09 -0800, Carl Banks wrote:
as has been posted before and again in a slightly different form in
Steve's post.
I'm well aware of it, but I didn't think the proposal deserved to be
called stupid when it was a reasonable solution to a real need, even
though a
On Nov 11, 4:12 pm, Steven D'Aprano
ste...@remove.this.cybersource.com.au wrote:
On Wed, 11 Nov 2009 03:52:45 -0800, Carl Banks wrote:
This is where a helper function is good. You want a dispatcher:
No I really don't. I want to be able to see the action performed
adjacent to the test, and
On Nov 11, 9:04 pm, Carl Banks pavlovevide...@gmail.com wrote:
(Carl's reply to Steven's comments...)
Well I don't just want to call a method, so I can't take that advice.
Some actions will do more than just to call a method. And I don't
want to scroll up or down ten screens to see what the
r wrote:
Forgive me if i don't properly explain the problem but i think the
following syntax would be quite beneficial to replace some redundant
if's in python code.
if something_that_returns_value() as value:
#do something with value
# Which can replace the following syntactical
Hi,
On 11/11/2009 12:53 AM, r wrote:
Forgive me if i don't properly explain the problem but i think the
following syntax would be quite beneficial to replace some redundant
if's in python code.
if something_that_returns_value() as value:
#do something with value
# Which can replace the
On 11/11/2009 02:05 AM, steve wrote:
Hi,
On 11/11/2009 12:53 AM, r wrote:
[...snip...]
i dunno, just seems to make good sense. You save one line of code but
more importantly one indention level. However i have no idea how much
trouble the implementation would be?
I guess the problem would
r:
i think the following syntax would be quite beneficial
to replace some redundant if's in python code.
http://python.org/dev/peps/pep-3003/
bearophile
--
http://mail.python.org/mailman/listinfo/python-list
On Nov 10, 2:08 pm, Robert Latest boblat...@yahoo.com wrote:
(..snip..)
Also it's not the if that is (if at all) redundant here but the assignment.
Not exactly. The assignment happens only once just as the boolean
check of if value happens once. The redundancy is in validating
the existence of a
On Tue, 10 Nov 2009 12:45:13 -0800, Bearophile wrote:
r:
i think the following syntax would be quite beneficial to replace some
redundant if's in python code.
http://python.org/dev/peps/pep-3003/
I knew it wouldn't take long for people to start responding to any
proposal with don't
On Nov 10, 11:23 am, r rt8...@gmail.com wrote:
if something_that_returns_value() as value:
#do something with value
Been proposed before. No one has bothered to write a PEP for it, so I
can't say for sure how the Python gods would react, but I suspect a
meh, don't think it's important
On Nov 10, 7:12 pm, Steven D'Aprano
ste...@remove.this.cybersource.com.au wrote:
On Tue, 10 Nov 2009 12:45:13 -0800, Bearophile wrote:
r:
i think the following syntax would be quite beneficial to replace some
redundant if's in python code.
http://python.org/dev/peps/pep-3003/
I knew it
On Nov 10, 9:12 pm, Steven D'Aprano
ste...@remove.this.cybersource.com.au wrote:
(..snip..)
Hint to would-be language designers: if you start off by claiming that a
new feature will save an indent level, when in fact it *doesn't* save an
indent level, you can save yourself from embarrassment by
On Tue, 10 Nov 2009 20:13:21 -0800, Carl Banks wrote:
On Nov 10, 7:12 pm, Steven D'Aprano
ste...@remove.this.cybersource.com.au wrote:
On Tue, 10 Nov 2009 12:45:13 -0800, Bearophile wrote:
r:
i think the following syntax would be quite beneficial to replace
some redundant if's in python
Carl Banks wrote:
r didn't actually give a good example. Here is case where it's
actually useful. (Pretend the regexps are too complicated to be
parsed with string method.)
if re.match(r'go\s+(north|south|east|west)',cmd) as m:
hero.move(m.group(1))
elif re.match(r'take\s+(\w+)',cmd) as
On Nov 10, 2:49 pm, steve st...@lonetwin.net wrote:
(..snip..)
However, the same 'effect' can be obtained with the 'with' statement:
(..snip..)
Hardly!,Here is an interactive session with your test case
#--#
class
On Tue, 10 Nov 2009 23:00:09 -0800, r wrote:
I think what has escaped everyone (including myself until my second
post) is the fact that what really needs to happen
Why?
is for variable
*assignments* to return a boolean to any statements that evaluate the
assignment -- like in an if or
48 matches
Mail list logo